Brijesh's Git Server — watchman @ 620f0d0941040f67e80c42836d12911027389218

observability tool, needs to be rewritten once identity is stable

utils/env_vars.go (view raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
package utils

import (
	"log"
	"os"

	"github.com/joho/godotenv"
)

func Load_ENV(env_var string) string {
	err := godotenv.Load()
	if err != nil {
		log.Fatal("Error loading .env file")
	}

	return os.Getenv(env_var)
}

func Verify_ENV_Exists(env_var string) bool {
	err := godotenv.Load()
	if err != nil {
		log.Fatal("Error loading .env file")
	}
	if os.Getenv(env_var) == "" {
		return false
	}
	return true
}