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
}