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 <noreply@anthropic.com>
This commit is contained in:
Long Dinh
2026-05-18 03:11:19 +07:00
parent 605adaa3c2
commit ed0ac68324
+12
View File
@@ -247,6 +247,18 @@ func main() {
// Parse the command-line flags. // Parse the command-line flags.
flag.Parse() 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. // Core application variables.
var err error var err error
var cfg *config.Config var cfg *config.Config