34 lines
824 B
Go
34 lines
824 B
Go
// Receive and send informations about servers
|
|
package main
|
|
|
|
import (
|
|
h "infra-dashboard/Http"
|
|
tools "infra-dashboard/Tools"
|
|
"log"
|
|
"net/http"
|
|
|
|
"github.com/alexflint/go-arg"
|
|
"github.com/gorilla/mux"
|
|
)
|
|
|
|
var (
|
|
args struct {
|
|
Log string `arg:"-l,--logfile" help:"location of output logfile." default:"/app/http-broadcaster.log"`
|
|
EnvFile string `arg:"-e,--envfile" help:"location of file containing environment variables." default:".env"`
|
|
Metrics bool `arg:"--metrics" help:"enable prometheus exporter on /metrics." default:"false"`
|
|
}
|
|
)
|
|
|
|
func main() {
|
|
arg.MustParse(&args)
|
|
tools.InitLog(args.Log)
|
|
tools.ReadDotEnvFile(args.EnvFile)
|
|
|
|
router := mux.NewRouter()
|
|
|
|
router.HandleFunc("/", h.RequestHandler)
|
|
router.HandleFunc("/healthcheck", h.HealthHandler)
|
|
|
|
log.Fatal(http.ListenAndServe(":8080", router))
|
|
}
|