CLI fixes for PORT and IP/HOST

pull/662/head
hunterlong 2020-06-13 19:46:31 -07:00
parent 622d697c6b
commit de051d4bcd
4 changed files with 4 additions and 10 deletions

View File

@ -24,12 +24,4 @@ func parseFlags(cmd *cobra.Command) {
cmd.PersistentFlags().StringVarP(&configFile, "config", "c", utils.Directory+"/config.yml", "path to config.yml file")
utils.Params.BindPFlag("config", cmd.PersistentFlags().Lookup("config"))
if utils.Params.GetString("SERVER_IP") != ipAddress {
utils.Params.Set("SERVER_IP", ipAddress)
}
if utils.Params.GetInt("SERVER_PORT") != port {
utils.Params.Set("SERVER_PORT", port)
}
}

View File

@ -80,6 +80,9 @@ func start() {
log.Info(fmt.Sprintf("Starting Statping v%s", VERSION))
utils.Params.Set("SERVER_IP", ipAddress)
utils.Params.Set("SERVER_PORT", port)
confgs, err = configs.LoadConfigs(configFile)
if err != nil {
log.Infoln("Starting in Setup Mode")

View File

@ -143,6 +143,7 @@ func removeJwtToken(w http.ResponseWriter) {
Name: cookieKey,
Value: "",
Expires: time.Now(),
MaxAge: -1,
})
}

View File

@ -25,8 +25,6 @@ func InitEnvs() {
defaultDir = "."
}
Params.Set("VERSION", version)
Params.SetDefault("SERVER_IP", "0.0.0.0")
Params.SetDefault("SERVER_PORT", 8080)
Params.SetDefault("DISABLE_HTTP", false)
Params.SetDefault("STATPING_DIR", defaultDir)
Params.SetDefault("GO_ENV", "production")