From d963c3f40f075c05d70af32f44ed2bec8e00bc37 Mon Sep 17 00:00:00 2001 From: Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> Date: Sat, 22 Oct 2022 19:07:14 +0300 Subject: init --- backend/controllers/funcs.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 backend/controllers/funcs.go (limited to 'backend/controllers/funcs.go') diff --git a/backend/controllers/funcs.go b/backend/controllers/funcs.go new file mode 100644 index 0000000..6d0f854 --- /dev/null +++ b/backend/controllers/funcs.go @@ -0,0 +1,16 @@ +package controllers + +import ( + "log" + "os" + + "github.com/joho/godotenv" +) + +func GetEnvKey(key string) string { + err := godotenv.Load() + if err != nil { + log.Fatal("Error loading .env file") + } + return os.Getenv(key) +} -- cgit v1.2.3