updown/main.go

35 lines
636 B
Go
Raw Normal View History

2019-02-25 04:41:57 +00:00
package main
import (
"fmt"
"github.com/ollien/updown/config"
2019-03-10 18:53:08 +00:00
"github.com/ollien/updown/handler/log"
2019-03-09 03:36:21 +00:00
"github.com/ollien/updown/repository"
2019-02-27 02:52:10 +00:00
"github.com/ollien/updown/web"
2019-02-25 04:41:57 +00:00
)
func main() {
2019-03-10 18:53:08 +00:00
logger := log.Get()
appConfig, err := config.Load()
2019-02-25 04:41:57 +00:00
if err == config.ErrDefaultConfig {
logger.Warn(err)
} else if err != nil {
logger.Fatal(err)
}
2019-03-09 03:36:21 +00:00
logger.Info("Connecting to database...")
_, err = repository.Connect()
if err != nil {
logger.Fatal(err)
}
2019-02-27 02:52:10 +00:00
logger.Info("Starting webserver...")
fmt.Printf("%+v\n", appConfig)
2019-03-09 02:39:46 +00:00
webserver := web.NewWebserver()
2019-02-27 02:52:10 +00:00
err = webserver.Start()
if err != nil {
logger.Error(err)
}
2019-02-25 04:41:57 +00:00
}