feat(config): read a flag in .env to set or not json output
This commit is contained in:
@@ -15,6 +15,7 @@ type Config struct {
|
||||
SMTP SMTPConfig
|
||||
App AppConfig
|
||||
RateLimit RateLimitConfig
|
||||
CLI CLIConfig
|
||||
LogDir string
|
||||
PIDDir string
|
||||
}
|
||||
@@ -81,6 +82,10 @@ type RateLimitConfig struct {
|
||||
TrustProxyHeaders bool
|
||||
}
|
||||
|
||||
type CLIConfig struct {
|
||||
JSONOutputDefault bool
|
||||
}
|
||||
|
||||
func Load() (*Config, error) {
|
||||
config := &Config{
|
||||
Database: DatabaseConfig{
|
||||
@@ -137,6 +142,9 @@ func Load() (*Config, error) {
|
||||
MetricsLimit: getEnvAsInt("RATE_LIMIT_METRICS", 20),
|
||||
TrustProxyHeaders: getEnvAsBool("RATE_LIMIT_TRUST_PROXY", false),
|
||||
},
|
||||
CLI: CLIConfig{
|
||||
JSONOutputDefault: getEnvAsBool("CLI_JSON_OUTPUT", false),
|
||||
},
|
||||
LogDir: getEnv("LOG_DIR", "/var/log/"),
|
||||
PIDDir: getEnv("PID_DIR", "/run"),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user