package config import ( "os" "github.com/joho/godotenv" ) // Config holds all application configuration. type Config struct { Port string DatabaseURL string JWTSecret string Environment string } // Load reads configuration from environment variables. // A .env file is loaded if present but not required. func Load() *Config { // Best-effort .env load (not required in production) _ = godotenv.Load() return &Config{ Port: getEnv("PORT", "8080"), DatabaseURL: getEnv("DATABASE_URL", ""), JWTSecret: getEnv("JWT_SECRET", "dev-secret-change-me"), Environment: getEnv("ENVIRONMENT", "development"), } } func getEnv(key, fallback string) string { if v := os.Getenv(key); v != "" { return v } return fallback }