package config

import (
	"os"

	"github.com/gofiber/fiber/v2/log"
	"github.com/joho/godotenv"
)

var ErrLoadingEnvs error

func init() {
	ErrLoadingEnvs = godotenv.Load()
}

func GetEnv(name string, defVal string) string {
	env := os.Getenv(name)
	if env == "" {
		log.Panicf("Missing %s env variable", name)
	}

	return env
}