diff --git a/cmd/flags.go b/cmd/flags.go index afe1986e..42407ffe 100644 --- a/cmd/flags.go +++ b/cmd/flags.go @@ -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) - } } diff --git a/cmd/main.go b/cmd/main.go index a32d1113..eb8648d2 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -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") diff --git a/handlers/dashboard.go b/handlers/dashboard.go index 3500d5a3..44a753f5 100644 --- a/handlers/dashboard.go +++ b/handlers/dashboard.go @@ -143,6 +143,7 @@ func removeJwtToken(w http.ResponseWriter) { Name: cookieKey, Value: "", Expires: time.Now(), + MaxAge: -1, }) } diff --git a/utils/env.go b/utils/env.go index 57a9f1c7..295760c9 100644 --- a/utils/env.go +++ b/utils/env.go @@ -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")