35 lines
687 B
Go
35 lines
687 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"net/http"
|
|
"strconv"
|
|
|
|
"github.com/go-chi/chi"
|
|
"github.com/ollien/updown/config"
|
|
"github.com/ollien/updown/web"
|
|
"github.com/sirupsen/logrus"
|
|
)
|
|
|
|
func main() {
|
|
logger := logrus.New()
|
|
appConfig, err := config.NewConfig()
|
|
if err == config.ErrDefaultConfig {
|
|
logger.Warn(err)
|
|
} else if err != nil {
|
|
logger.Fatal(err)
|
|
}
|
|
logger.Info("Starting webserver...")
|
|
fmt.Printf("%+v\n", appConfig)
|
|
httpServer := http.Server{
|
|
Addr: appConfig.Server.ListenAddr + ":" + strconv.Itoa(appConfig.Server.Port),
|
|
}
|
|
|
|
router := chi.NewRouter()
|
|
webserver := web.NewWebserver(&httpServer, router)
|
|
err = webserver.Start()
|
|
if err != nil {
|
|
logger.Error(err)
|
|
}
|
|
}
|