Skip to content

Commit

Permalink
feature: issue #38 - Config Directories
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesread committed Mar 23, 2022
1 parent bb96072 commit 3ad640a
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion cmd/OliveTin/main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package main

import (
"flag"

log "github.com/sirupsen/logrus"

grpcapi "github.com/jamesread/OliveTin/internal/grpcapi"
Expand Down Expand Up @@ -30,10 +32,18 @@ func init() {

log.SetLevel(log.DebugLevel) // Default to debug, to catch cfg issues

var configDir string;
flag.StringVar(&configDir, "configdir", ".", "Config directory path")
flag.Parse()

log.WithFields(log.Fields{
"value": configDir,
}).Debugf("Value of -configdir flag")

viper.AutomaticEnv()
viper.SetConfigName("config.yaml")
viper.SetConfigType("yaml")
viper.AddConfigPath(".")
viper.AddConfigPath(configDir)
viper.AddConfigPath("/config") // For containers.
viper.AddConfigPath("/etc/OliveTin/")

Expand Down

0 comments on commit 3ad640a

Please sign in to comment.