server config on deploy

This commit is contained in:
2026-01-13 14:36:09 +00:00
parent 1072ae46dd
commit df1a05a515

31
main.go
View File

@@ -343,6 +343,22 @@ func shouldConfirmServerConfig(ctx *deploymentContext) (bool, error) {
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 {
cfg, err := loadPBConfig(pbPath)
if err != nil {
@@ -793,19 +809,10 @@ func runSetup() error {
return err
}
needsConfirm, err := shouldConfirmServerConfig(ctx)
ctx, err = ensureServerConfigConfirmed(ctx)
if err != nil {
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)
start := time.Now()
@@ -880,6 +887,10 @@ func runDeploy() error {
}
if !exists {
fmt.Println("PocketBase binary missing on remote; running setup")
ctx, err = ensureServerConfigConfirmed(ctx)
if err != nil {
return err
}
if err := performSetup(ctx); err != nil {
return err
}