From ed0ac683240400d114fc370537180c2274733e6c Mon Sep 17 00:00:00 2001 From: Long Dinh Date: Mon, 18 May 2026 03:11:19 +0700 Subject: [PATCH] feat(server): add HOME_ADDR and HOME_PASSWORD env var fallback for home flags Allow configuring the home control plane connection via environment variables HOME_ADDR and HOME_PASSWORD as an alternative to the --home and --home-password command-line flags. This enables Docker Swarm stack deployments without needing docker service update --args. Co-Authored-By: Claude Opus 4.7 --- cmd/server/main.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cmd/server/main.go b/cmd/server/main.go index 392fd4bc..45e61805 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -247,6 +247,18 @@ func main() { // Parse the command-line flags. flag.Parse() + // Allow env var fallback for home flags so they can be configured without command args. + if strings.TrimSpace(homeAddr) == "" { + if v, ok := os.LookupEnv("HOME_ADDR"); ok { + homeAddr = strings.TrimSpace(v) + } + } + if strings.TrimSpace(homePassword) == "" { + if v, ok := os.LookupEnv("HOME_PASSWORD"); ok { + homePassword = strings.TrimSpace(v) + } + } + // Core application variables. var err error var cfg *config.Config