diff options
Diffstat (limited to 'config/config.go')
| -rw-r--r-- | config/config.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/config/config.go b/config/config.go new file mode 100644 index 0000000..85f947c --- /dev/null +++ b/config/config.go @@ -0,0 +1,22 @@ +package config + +import ( + "cafe/utils/env" + "log" + + "github.com/joho/godotenv" +) + +var ( + Server server +) + +func init() { + if err := godotenv.Load(); err != nil { + log.Println("No .env file found, using environment variables") + } + + if err := env.Parse(&Server); err != nil { + log.Fatalf("Failed to parse ServerConfig: %v", err) + } +} |
