package config import "os" // Config 持有 push-gateway 运行时配置 type Config struct { Port string JWTSecret string DevMode bool RedisURL string OTLPEndpoint string } // Load 从环境变量加载配置并提供默认值 func Load() *Config { return &Config{ Port: getEnv("PUSH_GATEWAY_PORT", "8081"), JWTSecret: getEnv("JWT_SECRET", "p1-dev-secret-change-in-production"), DevMode: getEnv("DEV_MODE", "false") == "true", RedisURL: getEnv("REDIS_URL", ""), OTLPEndpoint: getEnv("OTEL_EXPORTER_OTLP_ENDPOINT", "http://localhost:4318"), } } // getEnv 读取环境变量,缺失时返回 fallback func getEnv(key, fallback string) string { if v := os.Getenv(key); v != "" { return v } return fallback }