evilthings/main.go
2024-01-23 15:03:52 +01:00

31 lines
552 B
Go

package main
import (
"embed"
"log"
"net/http"
"os"
"github.com/sirupsen/logrus"
"gitlab.com/mstarongitlab/weblogger"
)
//go:embed templates
var embed_templates embed.FS
func main() {
port := os.Getenv("PORT")
if port == "" {
port = "8080"
log.Printf("Defaulting to port %s \n", port)
}
http.HandleFunc("/", handleRoot)
default_mux := http.DefaultServeMux
logger := weblogger.LoggingMiddleware(default_mux)
if err := http.ListenAndServe(":"+port, logger); err != nil {
logrus.WithField("event", "stop server").Fatal(err)
}
}