send all files
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
package variable
|
||||
|
||||
import (
|
||||
"log"
|
||||
"os"
|
||||
|
||||
"github.com/joho/godotenv"
|
||||
)
|
||||
|
||||
// use godot package to load/read the .env file and
|
||||
// return the value of the key
|
||||
func GetEnvVariable(key string) string {
|
||||
|
||||
// load .env file
|
||||
err := godotenv.Load(".env")
|
||||
|
||||
if err != nil {
|
||||
log.Fatalf("Error loading .env file")
|
||||
}
|
||||
|
||||
return os.Getenv(key)
|
||||
}
|
||||
Reference in New Issue
Block a user