Skip to content

Commit

Permalink
fix(config): get path from the working dir
Browse files Browse the repository at this point in the history
  • Loading branch information
Martijn-Faber committed Jan 15, 2022
1 parent 8bf0d35 commit 4f9bcba
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion config/config.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package config

import (
"os"

"github.com/spf13/viper"
)

Expand All @@ -17,7 +19,13 @@ type Config struct {
}

func Load() (config Config, err error) {
viper.AddConfigPath(".")
wd, err := os.Getwd()

if err != nil {
return
}

viper.AddConfigPath(wd)
viper.SetConfigName("config")
viper.SetConfigType("env")
viper.AutomaticEnv()
Expand Down

0 comments on commit 4f9bcba

Please sign in to comment.