fix(daemon): refuse startup with Dolt backend for deprecated --start flag

The guardDaemonStartForDolt check was only applied to the 'bd daemon start'
subcommand, but the deprecated 'bd daemon --start' flag path bypassed it.
This adds the same guard check to the deprecated path so both entry points
consistently refuse to start the daemon when Dolt backend is configured.

The --federation flag still allows Dolt since it enables dolt sql-server
mode which supports multi-writer access.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
gastown/crew/joe
2026-01-25 11:17:17 -08:00
parent d08c1b5162
commit c2d4a6d793

View File

@@ -63,6 +63,7 @@ Run 'bd daemon --help' to see all subcommands.`,
foreground, _ := cmd.Flags().GetBool("foreground")
logLevel, _ := cmd.Flags().GetString("log-level")
logJSON, _ := cmd.Flags().GetBool("log-json")
federation, _ := cmd.Flags().GetBool("federation")
// If no operation flags provided, show help
if !start && !stop && !stopAll && !status && !health && !metrics {
@@ -141,6 +142,15 @@ Run 'bd daemon --help' to see all subcommands.`,
os.Exit(1)
}
// Guard: refuse to start daemon with Dolt backend (unless --federation)
// This matches guardDaemonStartForDolt which guards the 'bd daemon start' subcommand.
if !federation {
if err := guardDaemonStartForDolt(cmd, args); err != nil {
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
os.Exit(1)
}
}
// Skip daemon-running check if we're the forked child (BD_DAEMON_FOREGROUND=1)
// because the check happens in the parent process before forking
if os.Getenv("BD_DAEMON_FOREGROUND") != "1" {
@@ -237,7 +247,6 @@ Run 'bd daemon --help' to see all subcommands.`,
fmt.Printf("Logging to: %s\n", logFile)
}
federation, _ := cmd.Flags().GetBool("federation")
federationPort, _ := cmd.Flags().GetInt("federation-port")
remotesapiPort, _ := cmd.Flags().GetInt("remotesapi-port")
startDaemon(interval, autoCommit, autoPush, autoPull, localMode, foreground, logFile, pidFile, logLevel, logJSON, federation, federationPort, remotesapiPort)