From cd5fd0c43e4b606cc827eb1d92cde2ae1c1a5f31 Mon Sep 17 00:00:00 2001 From: Blake Gentry Date: Thu, 2 May 2024 20:45:17 -0500 Subject: [PATCH] skip dotenv if env is set --- main.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index aa278d7..a70b1c5 100644 --- a/main.go +++ b/main.go @@ -27,8 +27,10 @@ var logger *slog.Logger //nolint:gochecknoglobals func main() { ctx := context.Background() - if err := godotenv.Load(); err != nil { - log.Fatal("Error loading .env file") + if os.Getenv("SKIP_DOTENV") != "1" { + if err := godotenv.Load(); err != nil { + log.Fatal("Error loading .env file") + } } logger = slog.New(slog.NewTextHandler(os.Stdout, nil))