2023-06-21 20:38:30 +02:00
|
|
|
package config
|
|
|
|
|
|
|
|
import (
|
|
|
|
"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-07-17 17:52:35 +02:00
|
|
|
return defVal
|
2023-06-21 20:38:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return env
|
|
|
|
}
|