Manually define env vars.

change-name
Robert Jacob 5 years ago
parent d07654ffb6
commit 3b5811f125
  1. 9
      cmd/spaceapi-server/main.go

@ -41,9 +41,14 @@ func readConfig() (config, error) {
pflag.String("xmpp-handle", c.XMPPHandle, "Nickname for MUC.")
pflag.Parse()
viper.SetEnvPrefix("spaceapi")
viper.AutomaticEnv()
viper.BindPFlags(pflag.CommandLine)
viper.BindEnv("addr", "SPACEAPI_ADDR")
viper.BindEnv("status-file", "SPACEAPI_STATUS_FILE")
viper.BindEnv("web-prefix", "SPACEAPI_WEB_PREFIX")
viper.BindEnv("xmpp-jid", "SPACEAPI_XMPP_JID")
viper.BindEnv("xmpp-password", "SPACEAPI_XMPP_PASSWORD")
viper.BindEnv("xmpp-target", "SPACEAPI_XMPP_TARGET")
viper.BindEnv("xmpp-handle", "SPACEAPI_XMPP_HANDLE")
c.Addr = viper.GetString("addr")
c.StatusFile = viper.GetString("status-file")

Loading…
Cancel
Save