From e7c9f03730ab674acb1debe4fe8aee1d18aaa4e3 Mon Sep 17 00:00:00 2001 From: Sledro Date: Fri, 1 Nov 2024 19:56:19 +0000 Subject: [PATCH] don't panic if .env is not found --- cmd/main.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cmd/main.go b/cmd/main.go index e5a2b0f..fcda434 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -25,11 +25,6 @@ import ( var Version = "development" func main() { - err := godotenv.Load() - if err != nil { - log.Fatal("Error loading .env file") - } - // create a new logger Logger := slog.New(tint.NewHandler(os.Stderr, nil)) @@ -45,6 +40,11 @@ func main() { "Operating System", runtime.GOOS, "Architecture", runtime.GOARCH) + err := godotenv.Load() + if err != nil { + Logger.Warn(".env file not found, will attempt to use environment variables from system") + } + llDefaultStartBlock, err := strconv.ParseUint(os.Getenv("LL_DEFAULT_START_BLOCK"), 10, 64) if err != nil { log.Fatalf("failed to parse LL_DEFAULT_START_BLOCK: %v", err)