Brijesh's Git Server — watchman @ d8af78ff7ad2ae757e1fad592c3d3a9572479ced

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
}