pull/10/head v0.29.2
Hunter Long 2018-07-04 03:14:00 -07:00
parent 1406398a8e
commit ab2832d0a3
5 changed files with 8 additions and 7 deletions

View File

@ -18,7 +18,7 @@ services:
env:
global:
- VERSION=0.29.1
- VERSION=0.29.2
- DB_HOST=localhost
- DB_USER=travis
- DB_PASS=

View File

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

View File

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

View File

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

View File

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