-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathmain.go
32 lines (26 loc) · 812 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package main
import (
"net/http"
"github.com/181192/custom-error-pages/pkg/handlers"
"github.com/181192/custom-error-pages/pkg/util"
"github.com/rs/zerolog/log"
"github.com/spf13/viper"
)
var (
gitCommit = "unversioned"
version = "unversioned"
date = "unversioned"
)
func main() {
util.InitFlags()
util.ConfigureLogger()
http.Handle("/", handlers.ErrorPage())
http.Handle("/metrics", handlers.Metrics())
http.Handle("/healthz", handlers.Health())
httpListenAddress := viper.GetString(util.HTTPListenAddress)
log.Debug().Msgf("config values: %+v", viper.AllSettings())
log.Info().Msgf("version=%s, commit=%s, date=%s", version, gitCommit, date)
log.Info().Msgf("listening on %s", httpListenAddress)
err := http.ListenAndServe(httpListenAddress, nil)
log.Fatal().Msg(err.Error())
}