LoadConfig loads configuration from environment variables.
()
| 45 | |
| 46 | // LoadConfig loads configuration from environment variables. |
| 47 | func LoadConfig() Config { |
| 48 | |
| 49 | if err := godotenv.Load(); err != nil { |
| 50 | log.Debug("No .env file found in current directory") |
| 51 | } |
| 52 | |
| 53 | cfg := Config{ |
| 54 | Port: os.Getenv("PORT"), |
| 55 | ModelName: os.Getenv("GEMINI_MODEL_NAME"), |
| 56 | GoogleAPIKey: os.Getenv("GOOGLE_API_KEY"), |
| 57 | } |
| 58 | |
| 59 | if cfg.Port == "" { |
| 60 | cfg.Port = "8081" // Default fallback |
| 61 | } |
| 62 | |
| 63 | if cfg.ModelName == "" { |
| 64 | cfg.ModelName = "gemini-2.5-flash" |
| 65 | } |
| 66 | |
| 67 | return cfg |
| 68 | } |
| 69 | |
| 70 | func main() { |
| 71 | // Configure charmbracelet/log |