statping/cmd/init.go

27 lines
488 B
Go
Raw Normal View History

2020-03-14 03:13:20 +00:00
package main
2020-03-04 10:29:00 +00:00
import (
2020-03-09 18:17:55 +00:00
"github.com/statping/statping/database"
2020-03-14 03:13:20 +00:00
"github.com/statping/statping/notifiers"
"github.com/statping/statping/types/core"
2020-03-09 18:17:55 +00:00
"github.com/statping/statping/types/services"
2020-03-04 10:29:00 +00:00
)
func InitApp() error {
2020-03-14 03:13:20 +00:00
if _, err := core.Select(); err != nil {
2020-03-04 10:29:00 +00:00
return err
}
2020-03-04 14:20:47 +00:00
2020-03-04 10:29:00 +00:00
if _, err := services.SelectAllServices(true); err != nil {
return err
}
2020-03-04 14:20:47 +00:00
2020-03-04 10:29:00 +00:00
go services.CheckServices()
2020-03-14 03:13:20 +00:00
notifiers.InitNotifiers()
2020-03-04 10:29:00 +00:00
database.StartMaintenceRoutine()
2020-03-14 03:13:20 +00:00
core.App.Setup = true
2020-03-04 10:29:00 +00:00
return nil
}