File tree Expand file tree Collapse file tree 3 files changed +17
-1
lines changed
Expand file tree Collapse file tree 3 files changed +17
-1
lines changed Original file line number Diff line number Diff line change 1414
1515package config
1616
17- import "os"
17+ import (
18+ "log"
19+ "os"
20+
21+ "github.com/joho/godotenv"
22+ )
1823
1924// TODO: something reasonable.
2025
@@ -35,6 +40,14 @@ func GetConfig() *Config {
3540}
3641
3742func init () {
43+ // Load .env file if it exists
44+ if err := godotenv .Load (); err != nil {
45+ // Only log if the file exists but couldn't be loaded
46+ if ! os .IsNotExist (err ) {
47+ log .Printf ("Error loading .env file: %v" , err )
48+ }
49+ }
50+
3851 c = Config {
3952 GeminiKey : os .Getenv ("GEMINI_KEY" ),
4053 MapboxKey : os .Getenv ("MAPBOX_KEY" ),
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ toolchain go1.23.3
77require (
88 github.com/google/uuid v1.6.0
99 github.com/honeycombio/beeline-go v1.18.0
10+ github.com/joho/godotenv v1.5.1
1011 github.com/redis/go-redis/v9 v9.7.1
1112 github.com/yuin/gopher-lua v1.1.1
1213 golang.org/x/exp v0.0.0-20250228200357-dead58393ab7
Original file line number Diff line number Diff line change @@ -38,6 +38,8 @@ github.com/honeycombio/beeline-go v1.18.0 h1:usCoLWAX0kMHPOd9+4sVM8MH0FZTTKaBm3U
3838github.com/honeycombio/beeline-go v1.18.0 /go.mod h1:EQ+Wz76mVNAT98hwahTqna61y/XVVxEqWyh4k87BXSM =
3939github.com/honeycombio/libhoney-go v1.25.0 h1:r33tlX90HtafK0bgRcjfNnsrJ9ZMTKuI/1DYaOFCc1o =
4040github.com/honeycombio/libhoney-go v1.25.0 /go.mod h1:Fc0HjqlwYf5xy6H34EItpOverAGbCixnYOX3YTUQovg =
41+ github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0 =
42+ github.com/joho/godotenv v1.5.1 /go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4 =
4143github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo =
4244github.com/klauspost/compress v1.18.0 /go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ =
4345github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM =
You can’t perform that action at this time.
0 commit comments