trepa/internal/core/helpers.go
2025-02-25 20:55:12 +00:00

25 lines
415 B
Go

package core
import (
"log/slog"
"os"
"github.com/joho/godotenv"
)
func LoadEnvVars(path string) {
err := godotenv.Load(path)
if err != nil {
slog.Warn("Error loading .env file", "path", path)
}
}
func MustGetEnvVar(key string) string {
value := os.Getenv(key)
if value == "" {
slog.Error("Environment variable is not set", "key", key)
panic("Environment variable is not set")
}
return value
}