package config import ( "os" "strconv" "time" ) // Google Sheets IDs — change in code if sheets change (not from env). const ( AttendanceSheetID = "1E2e_gT_K5AwSRCDLDTa2UetZTkHmBOcz0kFbBUNUNBA" PaymentsSheetID = "1Om0YPoDVCH5cV8BrNz5LG5eR5MMU05ypQC7UMN1xn_Y" JuniorSheetGID = "1213318614" ) // Config holds all runtime configuration loaded from environment variables. // Mirrors scripts/config.py. type Config struct { CredentialsPath string BankAccount string CacheTTL time.Duration CacheAPICheckTTL time.Duration LogLevel string FioAPIToken string ServerAddr string } // Load reads configuration from the environment, applying defaults that // match the Python side. func Load() Config { return Config{ CredentialsPath: env("CREDENTIALS_PATH", ".secret/fuj-management-bot-credentials.json"), BankAccount: env("BANK_ACCOUNT", "CZ8520100000002800359168"), CacheTTL: envDuration("CACHE_TTL_SECONDS", 300), CacheAPICheckTTL: envDuration("CACHE_API_CHECK_TTL_SECONDS", 300), LogLevel: env("LOG_LEVEL", "INFO"), FioAPIToken: env("FIO_API_TOKEN", ""), ServerAddr: env("SERVER_ADDR", ":8080"), } } func env(key, fallback string) string { if v := os.Getenv(key); v != "" { return v } return fallback } func envDuration(key string, defaultSeconds int) time.Duration { if v := os.Getenv(key); v != "" { if n, err := strconv.Atoi(v); err == nil && n > 0 { return time.Duration(n) * time.Second } } return time.Duration(defaultSeconds) * time.Second }