35 lines
636 B
Go
35 lines
636 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/ollien/updown/config"
|
|
"github.com/ollien/updown/handler/log"
|
|
"github.com/ollien/updown/repository"
|
|
"github.com/ollien/updown/web"
|
|
)
|
|
|
|
func main() {
|
|
logger := log.Get()
|
|
appConfig, err := config.Load()
|
|
if err == config.ErrDefaultConfig {
|
|
logger.Warn(err)
|
|
} else if err != nil {
|
|
logger.Fatal(err)
|
|
}
|
|
|
|
logger.Info("Connecting to database...")
|
|
_, err = repository.Connect()
|
|
if err != nil {
|
|
logger.Fatal(err)
|
|
}
|
|
|
|
logger.Info("Starting webserver...")
|
|
fmt.Printf("%+v\n", appConfig)
|
|
webserver := web.NewWebserver()
|
|
err = webserver.Start()
|
|
if err != nil {
|
|
logger.Error(err)
|
|
}
|
|
}
|