diff --git a/.travis.yml b/.travis.yml index 56d9e0aa..f6f8dfe0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,7 +18,7 @@ services: env: global: - - VERSION=0.29.1 + - VERSION=0.29.2 - DB_HOST=localhost - DB_USER=travis - DB_PASS= diff --git a/Dockerfile b/Dockerfile index f8ef4867..6725469a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ FROM alpine:latest -ENV VERSION=v0.29.1 +ENV VERSION=v0.29.2 RUN apk --no-cache add libstdc++ ca-certificates RUN wget -q https://github.com/hunterlong/statup/releases/download/$VERSION/statup-linux-alpine.tar.gz && \ diff --git a/core/core.go b/core/core.go index 3e8575b6..f69112b6 100644 --- a/core/core.go +++ b/core/core.go @@ -1,6 +1,7 @@ package core import ( + "fmt" "github.com/GeertJohan/go.rice" "github.com/hunterlong/statup/plugin" "github.com/hunterlong/statup/types" @@ -66,8 +67,10 @@ func InitApp() { func (c *Core) Update() (*Core, error) { res := DbSession.Collection("core").Find().Limit(1) err := res.Update(c) - CoreApp = c CoreApp.Services, err = SelectAllServices() + + fmt.Println(CoreApp.Name, CoreApp.Description) + return c, err } @@ -115,7 +118,6 @@ func SelectCore() (*Core, error) { CoreApp.DbConnection = Configs.Connection CoreApp.Version = VERSION CoreApp.Services, _ = SelectAllServices() - CoreApp.Update() //store = sessions.NewCookieStore([]byte(core.ApiSecret)) return CoreApp, err } diff --git a/core/database.go b/core/database.go index 37566cd8..fb047a34 100644 --- a/core/database.go +++ b/core/database.go @@ -201,10 +201,10 @@ func RunDatabaseUpgrades() error { CoreApp.Version = m } } - CoreApp.Update() - CoreApp, err = SelectCore() if ran > 0 { utils.Log(1, fmt.Sprintf("Database Upgraded, %v query ran", ran)) + CoreApp.Update() + CoreApp, err = SelectCore() } else { utils.Log(1, fmt.Sprintf("Database is already up-to-date, latest v%v", CoreApp.Version)) } diff --git a/core/services.go b/core/services.go index c96a86d6..c2abe4ab 100644 --- a/core/services.go +++ b/core/services.go @@ -126,7 +126,6 @@ func (s *Service) SmallText() string { func GroupDataBy(column string, id int64, tm time.Time, increment string) string { var sql string - fmt.Println("gropu by", column, CoreApp.DbConnection) switch CoreApp.DbConnection { case "mysql": sql = fmt.Sprintf("SELECT CONCAT(date_format(created_at, '%%Y-%%m-%%dT%%H:%%i:00Z')) AS created_at, AVG(latency)*1000 AS value FROM %v WHERE service=%v AND DATE_FORMAT(created_at, '%%Y-%%m-%%dT%%TZ') BETWEEN DATE_FORMAT('%v', '%%Y-%%m-%%dT%%TZ') AND DATE_FORMAT(NOW(), '%%Y-%%m-%%dT%%TZ') GROUP BY 1 ORDER BY created_at ASC;", column, id, tm.Format(time.RFC3339))