feat: add timezone configuration support to server settings and Docker image
Build / Build and Push (push) Successful in 45s
Build / Build and Push (push) Successful in 45s
This commit is contained in:
@@ -27,6 +27,7 @@ func getEnvInt(key string, defaultVal int) int {
|
||||
type ServerConfig struct {
|
||||
Port int `yaml:"port"`
|
||||
ListenAddr string `yaml:"listen_addr"`
|
||||
TimeZone string `yaml:"timezone"`
|
||||
}
|
||||
|
||||
type DatabaseConfig struct {
|
||||
@@ -95,5 +96,14 @@ func LoadConfig(path string) (*Config, error) {
|
||||
cfg.Database.Port = 3306
|
||||
}
|
||||
|
||||
if envTZ := os.Getenv("TZ"); envTZ != "" {
|
||||
cfg.Server.TimeZone = envTZ
|
||||
}
|
||||
|
||||
// Apply timezone if set
|
||||
if cfg.Server.TimeZone != "" {
|
||||
os.Setenv("TZ", cfg.Server.TimeZone)
|
||||
}
|
||||
|
||||
return &cfg, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user