Skip to content

Commit

Permalink
fix env (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
wyattchris authored Sep 24, 2024
1 parent c52ba16 commit 48844cb
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions backend/cmd/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ import (
func main() {
ctx := context.Background()

if err := godotenv.Load("../../../.env"); err != nil {
log.Fatalf("Error loading .env file: %v", err)
if isLocal() {
if err := godotenv.Load("../../../.env"); err != nil {
log.Fatalf("Error loading .env file: %v", err)
}
}

cfg, err := config.LoadConfig()
Expand Down Expand Up @@ -55,3 +57,7 @@ func main() {

slog.Info("Server shutdown")
}

func isLocal() bool {
return os.Getenv("APP_ENVIRONMENT") != "production"
}

0 comments on commit 48844cb

Please sign in to comment.