Files
auth-proxy/config.go
db123-test 7221feb6d4 feat: add permanent whitelist list endpoint and rename DB table
- Add GET /api/whitelist/perm/list to list permanent whitelisted entries
- Implement permWhitelistListHandler with API key verification
- Rename permanent_whitelist table to perm_whitelist for consistency
- Update default DB path from ./data to /data
- Comment out build job in CI/CD workflow
2026-05-04 11:29:01 +03:30

42 lines
859 B
Go

package main
import (
"os"
"time"
)
type Config struct {
Port string
APIToken string
DataDir string
CleanupInterval time.Duration
DBPath string
}
func loadConfig() Config {
return Config{
Port: getEnv("AUTH_PROXY_PORT", "8080"),
APIToken: getEnv("AUTH_PROXY_API_TOKEN", ""),
DataDir: getEnv("DATA_DIR", "/data"),
CleanupInterval: parseDuration("CLEANUP_INTERVAL", 60*time.Second),
DBPath: getEnv("AUTH_PROXY_DB_PATH", "/data/auth-proxy.db"),
}
}
func getEnv(key, defaultValue string) string {
if v := os.Getenv(key); v != "" {
return v
}
return defaultValue
}
func parseDuration(key string, defaultVal time.Duration) time.Duration {
if v := os.Getenv(key); v != "" {
d, err := time.ParseDuration(v)
if err == nil {
return d
}
}
return defaultVal
}