MCPcopy Create free account
hub / github.com/google/adk-samples / LoadConfig

Function LoadConfig

go/agents/boat-agent/main.go:47–68  ·  view source on GitHub ↗

LoadConfig loads configuration from environment variables.

()

Source from the content-addressed store, hash-verified

45
46// LoadConfig loads configuration from environment variables.
47func 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
70func main() {
71 // Configure charmbracelet/log

Callers 2

TestLoadConfigFunction · 0.85
mainFunction · 0.85

Calls 1

LoadMethod · 0.65

Tested by 1

TestLoadConfigFunction · 0.68