added config package

This commit is contained in:
2023-06-21 20:38:30 +02:00
parent 20b01eda68
commit 8baf928a5b
4 changed files with 26 additions and 1 deletions

22
config/config.go Normal file
View File

@@ -0,0 +1,22 @@
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 == "" {
return defVal
}
return env
}