deployment prep

This commit is contained in:
Simon Martens
2025-09-30 12:21:57 +02:00
parent fb7231248c
commit 4218db49b5
10 changed files with 63 additions and 15 deletions

View File

@@ -50,6 +50,8 @@ type Config struct {
Debug bool `json:"debug" envconfig:"DEBUG"`
Watch bool `json:"watch" envconfig:"WATCH"`
LogData bool `json:"log_data" envconfig:"LOG_DATA"`
Environment string `json:"environment" envconfig:"ENVIRONMENT"`
NoIndex bool `json:"no_index" envconfig:"NO_INDEX"`
Address string `json:"address" envconfig:"ADDRESS"`
Port string `json:"port" envconfig:"PORT"`
@@ -140,6 +142,14 @@ func readDefaults(cfg *Config) *Config {
cfg.PicturesPath = DEFAULT_PICTURES_DIR
}
if strings.TrimSpace(cfg.Environment) == "" {
if cfg.Debug {
cfg.Environment = "development"
} else {
cfg.Environment = "production"
}
}
return cfg
}