This commit is contained in:
2025-08-22 15:01:40 -04:00
parent 141b1e936d
commit f502f21473
10 changed files with 1455 additions and 4 deletions

View File

@ -42,6 +42,9 @@ type ConfigProvider interface {
// GetMetricsAddress returns the metrics server address in host:port format
GetMetricsAddress() string
// GetJWTSecret returns the JWT signing secret
GetJWTSecret() string
// IsDevelopment returns true if the environment is development
IsDevelopment() bool
@ -104,6 +107,7 @@ func (c *Config) setDefaults() {
"CACHE_ENABLED": "false",
"CACHE_TTL": "1h",
"JWT_ISSUER": "api-key-service",
"JWT_SECRET": "bootstrap-jwt-secret-change-in-production",
"AUTH_PROVIDER": "header", // header or sso
"AUTH_HEADER_USER_EMAIL": "X-User-Email",
"SSO_PROVIDER_URL": "",
@ -186,6 +190,7 @@ func (c *Config) Validate() error {
"SERVER_PORT",
"INTERNAL_APP_ID",
"INTERNAL_HMAC_KEY",
"JWT_SECRET",
}
var missing []string
@ -262,6 +267,11 @@ func (c *Config) GetMetricsAddress() string {
return fmt.Sprintf("%s:%d", c.GetString("SERVER_HOST"), c.GetInt("METRICS_PORT"))
}
// GetJWTSecret returns the JWT signing secret
func (c *Config) GetJWTSecret() string {
return c.GetString("JWT_SECRET")
}
// IsDevelopment returns true if the environment is development
func (c *Config) IsDevelopment() bool {
env := c.GetString("APP_ENV")