2019-09-04 23:37:13 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2019-12-04 21:44:35 +00:00
|
|
|
"os"
|
2020-10-30 15:30:03 +00:00
|
|
|
|
|
|
|
"github.com/TwinProduction/gatus/config"
|
2020-12-30 01:22:17 +00:00
|
|
|
"github.com/TwinProduction/gatus/controller"
|
2020-10-30 15:30:03 +00:00
|
|
|
"github.com/TwinProduction/gatus/watchdog"
|
2019-09-04 23:37:13 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
2019-12-04 21:44:35 +00:00
|
|
|
cfg := loadConfiguration()
|
2020-04-14 23:20:00 +00:00
|
|
|
go watchdog.Monitor(cfg)
|
2020-12-30 01:22:17 +00:00
|
|
|
controller.Handle()
|
2019-09-07 01:59:50 +00:00
|
|
|
}
|
|
|
|
|
2019-12-04 21:44:35 +00:00
|
|
|
func loadConfiguration() *config.Config {
|
|
|
|
var err error
|
2020-03-08 22:16:39 +00:00
|
|
|
customConfigFile := os.Getenv("GATUS_CONFIG_FILE")
|
|
|
|
if len(customConfigFile) > 0 {
|
|
|
|
err = config.Load(customConfigFile)
|
2019-12-04 21:44:35 +00:00
|
|
|
} else {
|
|
|
|
err = config.LoadDefaultConfiguration()
|
|
|
|
}
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
return config.Get()
|
|
|
|
}
|