From 4feac5e490e9f19d234ae5140a998552c3e869d9 Mon Sep 17 00:00:00 2001 From: lash Date: Sun, 12 Jan 2025 10:21:49 +0000 Subject: [PATCH] Remove env --- env/load.go | 40 ---------------------------------------- 1 file changed, 40 deletions(-) delete mode 100644 env/load.go diff --git a/env/load.go b/env/load.go deleted file mode 100644 index f0bbd7f..0000000 --- a/env/load.go +++ /dev/null @@ -1,40 +0,0 @@ -package env - -import ( - "log" - "os" - "path" - "strconv" - - "github.com/joho/godotenv" -) - -func LoadEnvVariables() { - LoadEnvVariablesPath(".") -} - -func LoadEnvVariablesPath(dir string) { - fp := path.Join(dir, ".env") - err := godotenv.Load(fp) - if err != nil { - log.Fatal("Error loading .env file", err) - } -} - -// Helper to get environment variables with a default fallback -func GetEnv(key, defaultVal string) string { - if value, exists := os.LookupEnv(key); exists { - return value - } - return defaultVal -} - -// Helper to safely convert environment variables to uint -func GetEnvUint(key string, defaultVal uint) uint { - if value, exists := os.LookupEnv(key); exists { - if parsed, err := strconv.Atoi(value); err == nil && parsed >= 0 { - return uint(parsed) - } - } - return defaultVal -}