2023-06-21 20:38:30 +02:00
|
|
|
package config
|
|
|
|
|
|
|
|
import (
|
2024-05-30 17:01:18 +02:00
|
|
|
"fmt"
|
2023-06-21 20:38:30 +02:00
|
|
|
"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 == "" {
|
2024-05-30 17:01:18 +02:00
|
|
|
fmt.Panicln("Missing " + name + " env variable")
|
2023-06-21 20:38:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return env
|
|
|
|
}
|