package config import ( "os" "strconv" ) type Config struct { DBHost string DBPort int DBUser string DBPassword string DBName string JWTSecret string JWTExpirationHours int RefreshExpDays int } func Load() *Config { return &Config{ DBHost: getEnv("DB_HOST", "localhost"), DBPort: getEnvAsInt("DB_PORT", 5432), DBUser: getEnv("DB_USER", "econ_user"), DBPassword: getEnv("DB_PASSWORD", "econ_pass"), DBName: getEnv("DB_NAME", "econ_db"), JWTSecret: getEnv("JWT_SECRET", "your-secret-key-change-in-production"), JWTExpirationHours: 15 * 60, // 15 minutes in minutes (900 minutes = 15 hours) RefreshExpDays: 7, } } func getEnv(key, defaultValue string) string { if value, exists := os.LookupEnv(key); exists { return value } return defaultValue } func getEnvAsInt(key string, defaultValue int) int { if value, exists := os.LookupEnv(key); exists { if intValue, err := strconv.Atoi(value); err == nil { return intValue } } return defaultValue }