Unmarshal config values into app struct

pull/1/head
Nikita Tokarchuk 3 years ago
parent 2e56c1daa6
commit c20306c118
Signed by: mainnika
GPG Key ID: A595FB7E3E56911C
  1. 8
      frontend/main.go

@ -5,6 +5,8 @@ import (
"github.com/sirupsen/logrus"
"github.com/spf13/viper"
"code.tokarch.uk/mainnika/nikita-tokarch-uk/frontend/config"
)
var Version = "nightly"
@ -21,5 +23,11 @@ func main() {
logrus.Debugf("Skip invalid config file %s, %v", viper.ConfigFileUsed(), err)
}
config := &config.Config{}
if err := viper.Unmarshal(config); err != nil {
logrus.Warnf("Cannot unmarshal config, %v", err)
}
logrus.Infof("Version: %s", Version)
logrus.Debugf("Conf: %#v", config)
}

Loading…
Cancel
Save