diff options
author | zberwaldt <17715430+zberwaldt@users.noreply.github.com> | 2024-03-15 22:03:11 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-15 22:03:11 -0400 |
commit | 6f8cfbd6cc3d5adbda38e74013c68e3d4745766d (patch) | |
tree | b3f045cd06d6622e23441b442e8f3861050ed444 /api/internal/config | |
parent | fac21fa0a72d4a7f1a01ccd44e3acf9c90fd95bd (diff) | |
parent | fd1332a3df191577e91c6d846a8b5db1747099fd (diff) |
Merge pull request #1 from zberwaldt/staging
Staging to Prod
Diffstat (limited to 'api/internal/config')
-rw-r--r-- | api/internal/config/config.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/api/internal/config/config.go b/api/internal/config/config.go new file mode 100644 index 0000000..d54e40e --- /dev/null +++ b/api/internal/config/config.go | |||
@@ -0,0 +1,17 @@ | |||
1 | package config | ||
2 | |||
3 | import ( | ||
4 | "fmt" | ||
5 | "github.com/spf13/viper" | ||
6 | ) | ||
7 | |||
8 | func Load() (*viper.Viper, error) { | ||
9 | v := viper.New() | ||
10 | v.SetConfigFile(".env") | ||
11 | v.AddConfigPath(".") | ||
12 | err := v.ReadInConfig() | ||
13 | if err != nil { | ||
14 | return nil, fmt.Errorf("error reading .env file: %s", err) | ||
15 | } | ||
16 | return v, nil | ||
17 | } | ||