24 lines
305 B
Go
24 lines
305 B
Go
package config
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
|
|
"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 == "" {
|
|
fmt.Panicln("Missing " + name + " env variable")
|
|
}
|
|
|
|
return env
|
|
}
|