trepa/internal/core/helpers.go
2025-02-20 12:09:38 +00:00

25 lines
386 B
Go

package core
import (
"log/slog"
"os"
"github.com/joho/godotenv"
)
func LoadEnvVars() {
err := godotenv.Load()
if err != nil {
slog.Warn("Error loading .env file")
}
}
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
}