pull/627/head
hunterlong 2020-06-04 06:13:32 -07:00
parent eddf378938
commit 128c53e5e1
9 changed files with 56 additions and 37 deletions

View File

@ -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.

View File

@ -9,7 +9,7 @@
<div class="row">
<div class="col-6">
<div class="form-group">
<label>{{ $t('setup.language') }}</label>
<label class="text-capitalize">{{ $t('setup.language') }}</label>
<select @change="changeLanguages" v-model="setup.language" id="language" class="form-control">
<option value="en">English</option>
<option value="es">Spanish</option>
@ -19,7 +19,7 @@
</select>
</div>
<div class="form-group">
<label>{{ $t('setup.connection') }}</label>
<label class="text-capitalize">{{ $t('setup.connection') }}</label>
<select @change="canSubmit" v-model="setup.db_connection" id="db_connection" class="form-control">
<option value="sqlite">SQLite</option>
<option value="postgres">Postgres</option>
@ -27,23 +27,23 @@
</select>
</div>
<div v-if="setup.db_connection !== 'sqlite'" class="form-group">
<label>{{ $t('setup.host') }}</label>
<label class="text-capitalize">{{ $t('setup.host') }}</label>
<input @keyup="canSubmit" v-model="setup.db_host" id="db_host" type="text" class="form-control" placeholder="localhost">
</div>
<div v-if="setup.db_connection !== 'sqlite'" class="form-group">
<label>{{ $t('port') }}</label>
<label class="text-capitalize">{{ $t('port') }}</label>
<input @keyup="canSubmit" v-model="setup.db_port" id="db_port" type="text" class="form-control" placeholder="localhost">
</div>
<div v-if="setup.db_connection !== 'sqlite'" class="form-group">
<label>{{ $t('username') }}</label>
<label class="text-capitalize">{{ $t('username') }}</label>
<input @keyup="canSubmit" v-model="setup.db_user" id="db_user" type="text" class="form-control" placeholder="root">
</div>
<div v-if="setup.db_connection !== 'sqlite'" class="form-group">
<label for="db_password">{{ $t('password') }}</label>
<label for="db_password" class="text-capitalize">{{ $t('password') }}</label>
<input @keyup="canSubmit" v-model="setup.db_password" id="db_password" type="password" class="form-control" placeholder="password123">
</div>
<div v-if="setup.db_connection !== 'sqlite'" class="form-group">
<label for="db_database">{{ $t('database') }}</label>
<label for="db_database" class="text-capitalize">{{ $t('database') }}</label>
<input @keyup="canSubmit" v-model="setup.db_database" id="db_database" type="text" class="form-control" placeholder="Database name">
</div>
@ -52,43 +52,43 @@
<div class="col-6">
<div class="form-group">
<label>{{ $t('setup.project_name') }}</label>
<label class="text-capitalize">{{ $t('setup.project_name') }}</label>
<input @keyup="canSubmit" v-model="setup.project" id="project" type="text" class="form-control" placeholder="Great Uptime" required>
</div>
<div class="form-group">
<label>{{ $t('setup.project_description') }}</label>
<label class="text-capitalize">{{ $t('setup.project_description') }}</label>
<input @keyup="canSubmit" v-model="setup.description" id="description" type="text" class="form-control" placeholder="Great Uptime">
</div>
<div class="form-group">
<label for="domain">{{ $t('setup.domain') }}</label>
<label class="text-capitalize" for="domain">{{ $t('setup.domain') }}</label>
<input @keyup="canSubmit" v-model="setup.domain" type="text" class="form-control" id="domain" required>
</div>
<div class="form-group">
<label>{{ $t('setup.username') }}</label>
<label class="text-capitalize">{{ $t('setup.username') }}</label>
<input @keyup="canSubmit" v-model="setup.username" id="username" type="text" class="form-control" placeholder="admin" required>
</div>
<div class="form-group">
<label>{{ $t('setup.username') }}</label>
<label class="text-capitalize">{{ $t('setup.username') }}</label>
<input @keyup="canSubmit" v-model="setup.password" id="password" type="password" class="form-control" placeholder="password" required>
</div>
<div class="form-group">
<label>{{ $t('setup.password_confirm') }}</label>
<label class="text-capitalize">{{ $t('setup.password_confirm') }}</label>
<input @keyup="canSubmit" v-model="setup.confirm_password" id="password_confirm" type="password" class="form-control" placeholder="password" required>
</div>
<div class="form-group">
<div class="row">
<div class="col-8">
<label>{{ $t('email') }}</label>
<label class="text-capitalize">{{ $t('email') }}</label>
<input @keyup="canSubmit" v-model="setup.email" id="email" type="text" class="form-control" placeholder="myemail@domain.com">
</div>
<div class="col-4">
<label class="d-none d-sm-block">{{ $t('setup.newsletter') }}</label>
<label class="d-none d-sm-block text-capitalize text-capitalize">{{ $t('setup.newsletter') }}</label>
<span @click="setup.newsletter = !!setup.newsletter" class="switch">
<input v-model="setup.newsletter" type="checkbox" name="using_cdn" class="switch" id="send_newsletter" :checked="setup.newsletter">
<label for="send_newsletter"></label>

View File

@ -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.",

2
go.mod
View File

@ -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

View File

@ -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/"))

View File

@ -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() {

View File

@ -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
}

View File

@ -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{}
}

View File

@ -1 +1 @@
0.90.45
0.90.46