|
|
|
@ -32,7 +32,10 @@ import (
|
|
|
|
|
"github.com/spf13/pflag"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
const defaultServerPort = 3000
|
|
|
|
|
const (
|
|
|
|
|
defaultServerPort = 3000
|
|
|
|
|
defaultFile = "idp.toml"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
var DefaultConfig = map[string]interface{}{
|
|
|
|
|
"server.bind_address": "",
|
|
|
|
@ -74,6 +77,10 @@ func ConfigureApplication(
|
|
|
|
|
|
|
|
|
|
_ = config.Load(confmap.Provider(defaultConfig, "."), nil)
|
|
|
|
|
|
|
|
|
|
if err = config.Load(file.Provider(defaultFile), toml.Parser()); err != nil && !os.IsNotExist(err) {
|
|
|
|
|
logrus.WithError(err).WithField("file", defaultFile).Fatal("error loading configuration from file")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cFiles, _ := f.GetStringSlice("conf")
|
|
|
|
|
for _, c := range cFiles {
|
|
|
|
|
if err = config.Load(file.Provider(c), toml.Parser()); err != nil {
|
|
|
|
@ -85,13 +92,6 @@ func ConfigureApplication(
|
|
|
|
|
logger.WithError(err).Fatal("error loading configuration from command line")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if err = config.Load(
|
|
|
|
|
file.Provider("idp.toml"),
|
|
|
|
|
toml.Parser(),
|
|
|
|
|
); err != nil && !os.IsNotExist(err) {
|
|
|
|
|
logrus.WithError(err).Fatal("error loading configuration from resource_app.toml")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
prefix := fmt.Sprintf("%s_", strings.ToUpper(appName))
|
|
|
|
|
|
|
|
|
|
if err = config.Load(env.Provider(prefix, ".", func(s string) string {
|
|
|
|
|