server config on deploy
This commit is contained in:
31
main.go
31
main.go
@@ -343,6 +343,22 @@ func shouldConfirmServerConfig(ctx *deploymentContext) (bool, error) {
|
|||||||
return !exists, nil
|
return !exists, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func ensureServerConfigConfirmed(ctx *deploymentContext) (*deploymentContext, error) {
|
||||||
|
needsConfirm, err := shouldConfirmServerConfig(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if !needsConfirm {
|
||||||
|
return ctx, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := confirmServerConfig(ctx.configPath); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return buildDeploymentContext()
|
||||||
|
}
|
||||||
|
|
||||||
func confirmServerConfig(pbPath string) error {
|
func confirmServerConfig(pbPath string) error {
|
||||||
cfg, err := loadPBConfig(pbPath)
|
cfg, err := loadPBConfig(pbPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -793,19 +809,10 @@ func runSetup() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
needsConfirm, err := shouldConfirmServerConfig(ctx)
|
ctx, err = ensureServerConfigConfirmed(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if needsConfirm {
|
|
||||||
if err := confirmServerConfig(ctx.configPath); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
ctx, err = buildDeploymentContext()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
defer closeSSHControlMaster(ctx.serverIP)
|
defer closeSSHControlMaster(ctx.serverIP)
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
@@ -880,6 +887,10 @@ func runDeploy() error {
|
|||||||
}
|
}
|
||||||
if !exists {
|
if !exists {
|
||||||
fmt.Println("PocketBase binary missing on remote; running setup")
|
fmt.Println("PocketBase binary missing on remote; running setup")
|
||||||
|
ctx, err = ensureServerConfigConfirmed(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
if err := performSetup(ctx); err != nil {
|
if err := performSetup(ctx); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user