diff --git a/CHANGELOG.md b/CHANGELOG.md index 32471f02..72198bd9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# 0.90.46 (06-04-2020) +- Add i18n language translations for frontend +- Added PR for heatmap https://github.com/statping/statping/pull/589 +- Added Statping newsletter option during /setup mode +- Fix for disabling logs with `DISABLE_LOGS` env + # 0.90.45 (06-01-2020) - Merged PR [#612](https://github.com/statping/statping/pull/612) for edit/create service issue. diff --git a/frontend/src/forms/Setup.vue b/frontend/src/forms/Setup.vue index e72b6e6f..5d6ab532 100644 --- a/frontend/src/forms/Setup.vue +++ b/frontend/src/forms/Setup.vue @@ -9,7 +9,7 @@
- +
- +
- +
- +
- +
- +
- +
@@ -52,43 +52,43 @@
- +
- +
- +
- +
- +
- +
- +
- + diff --git a/frontend/src/languages/english.js b/frontend/src/languages/english.js index 6a89c661..ca8cfd6b 100644 --- a/frontend/src/languages/english.js +++ b/frontend/src/languages/english.js @@ -8,7 +8,7 @@ const english = { project_description: "Project Description", domain: "Domain URL", username: "Admin Username", - password: "Admin Username", + password: "Admin Password", password_confirm: "Confirm Admin Username", newsletter: "Newsletter", newsletter_note: "We will not share your email, emails are only for major updates.", diff --git a/go.mod b/go.mod index cd267f11..f34d3d4d 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( github.com/fsnotify/fsnotify v1.4.9 // indirect github.com/getsentry/sentry-go v0.5.1 github.com/go-mail/mail v2.3.1+incompatible - github.com/golang/protobuf v1.3.5 + github.com/golang/protobuf v1.3.5 // indirect github.com/gorilla/mux v1.7.4 github.com/jinzhu/gorm v1.9.12 github.com/magiconair/properties v1.8.1 diff --git a/handlers/routes.go b/handlers/routes.go index ffe130de..46e6aaf5 100644 --- a/handlers/routes.go +++ b/handlers/routes.go @@ -8,6 +8,7 @@ import ( "github.com/statping/statping/types/core" "github.com/statping/statping/utils" "net/http" + "net/http/pprof" ) var ( @@ -29,7 +30,6 @@ func Router() *mux.Router { authUser := utils.Params.GetString("AUTH_USERNAME") authPass := utils.Params.GetString("AUTH_PASSWORD") - if authUser != "" && authPass != "" { r.Use(basicAuthHandler) } @@ -45,7 +45,22 @@ func Router() *mux.Router { r.Handle("/", sentryHandler.Handle(http.HandlerFunc(indexHandler))) } - r.Use(sendLog) + if !utils.Params.GetBool("DISABLE_LOGS") { + r.Use(sendLog) + } + + if utils.Params.GetString("GO_ENV") == "test" { + go func() { + log.Infoln("Starting pprof web server on http://0.0.0.0:9090") + r := http.NewServeMux() + r.HandleFunc("/debug/pprof/", pprof.Index) + r.HandleFunc("/debug/pprof/cmdline", pprof.Cmdline) + r.HandleFunc("/debug/pprof/profile", pprof.Profile) + r.HandleFunc("/debug/pprof/symbol", pprof.Symbol) + r.HandleFunc("/debug/pprof/trace", pprof.Trace) + http.ListenAndServe(":9090", r) + }() + } if source.UsingAssets(dir) { indexHandler := http.FileServer(http.Dir(dir + "/assets/")) diff --git a/utils/configs.go b/utils/configs.go index a44c3091..420b5144 100644 --- a/utils/configs.go +++ b/utils/configs.go @@ -2,6 +2,7 @@ package utils import ( "github.com/spf13/viper" + "io/ioutil" "os" "time" ) @@ -28,6 +29,17 @@ func InitCLI() { Params.ReadInConfig() Params.Set("VERSION", version) + + // check if logs are disabled + disableLogs = Params.GetBool("DISABLE_LOGS") + if disableLogs { + Log.Out = ioutil.Discard + } + + Log.Debugln("current working directory: ", Directory) + Log.AddHook(new(hook)) + Log.SetNoLock() + checkVerboseMode() } func setDefaults() { diff --git a/utils/log.go b/utils/log.go index 205679a1..71dabbcf 100644 --- a/utils/log.go +++ b/utils/log.go @@ -146,6 +146,9 @@ func createLog(dir string) error { // InitLogs will create the '/logs' directory and creates a file '/logs/statup.log' for application logging func InitLogs() error { + if Params.GetBool("DISABLE_LOGS") { + return nil + } if err := createLog(Directory); err != nil { return err } @@ -164,8 +167,6 @@ func InitLogs() error { DisableColors: false, }) checkVerboseMode() - - LastLines = make([]*logRow, 0) return nil } diff --git a/utils/utils.go b/utils/utils.go index 2d6dce27..e9bc4df4 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -24,21 +24,6 @@ var ( disableLogs bool ) -// init will set the utils.Directory to the current running directory, or STATPING_DIR if it is set -func init() { - InitCLI() - // check if logs are disabled - disableLogs = Params.GetBool("DISABLE_LOGS") - if disableLogs { - Log.Out = ioutil.Discard - } - - Log.Debugln("current working directory: ", Directory) - Log.AddHook(new(hook)) - Log.SetNoLock() - checkVerboseMode() -} - type env struct { data interface{} } diff --git a/version.txt b/version.txt index 75f71227..d1971963 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -0.90.45 +0.90.46