We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 21cc812 commit 76ad359Copy full SHA for 76ad359
main.go
@@ -9,19 +9,23 @@ import (
9
"github.com/rs/zerolog"
10
"github.com/rs/zerolog/log"
11
"github.com/spf13/viper"
12
+ "os"
13
"strings"
14
"time"
15
)
16
17
func main() {
18
- log.Info().Msg("starting frigabun")
19
- log.Info().Msg("reading config")
+ _, err := os.Stat("/data/options.json")
20
+ if err != nil {
21
+ viper.AddConfigPath(".")
22
+ viper.SetConfigType("toml")
23
+ } else {
24
+ viper.AddConfigPath("/data")
25
+ viper.SetConfigName("options")
26
+ }
27
- viper.SetConfigName("config")
- viper.SetConfigType("toml")
- viper.AddConfigPath(".")
- err := viper.ReadInConfig()
28
+ err = viper.ReadInConfig()
29
if err != nil {
30
log.Fatal().Err(err).Msg("could not read config file")
31
}
0 commit comments