From 9a8b44571ce36215e9254728e548c1b919b379c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jose=20Ramon=20Ma=C3=B1es?= <32740567+jrmanes@users.noreply.github.com> Date: Tue, 7 May 2024 17:14:33 +0200 Subject: [PATCH] fix(env): handlering env error (#324) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jose Ramon MaƱes --- pkg/knuu/knuu.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkg/knuu/knuu.go b/pkg/knuu/knuu.go index 773a45f..a8302c1 100644 --- a/pkg/knuu/knuu.go +++ b/pkg/knuu/knuu.go @@ -52,9 +52,12 @@ func InitializeWithScope(scope string) error { var err error err = godotenv.Load() if err != nil { - return ErrCannotLoadEnv.Wrap(err) + if os.IsNotExist(err) { + logrus.Warn("The .env file does not exist, continuing without loading environment variables.") + } else { + return ErrCannotLoadEnv.Wrap(err) + } } - if scope == "" { return ErrCannotInitializeKnuuWithEmptyScope }