Separated address and port config

This commit is contained in:
2022-01-31 11:55:19 +01:00
parent bc4c27cff3
commit 6dd8d48f35
3 changed files with 10 additions and 4 deletions

View File

@@ -33,7 +33,7 @@ func main() {
}
database.SetGlobDB(db)
if err := http.ListenAndServe(fmt.Sprintf("%s", config.ServerAddress), r); err != nil {
if err := http.ListenAndServe(fmt.Sprintf(":%s", config.ServerPort), r); err != nil {
panic(err)
}
}
@@ -62,7 +62,9 @@ func setupFrontend(r *mux.Router) {
r.PathPrefix("/").HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if path.Join(config.Prefix)+"/" == r.URL.Path {
landingpage.Execute(w, config.PageBase)
if err := landingpage.Execute(w, config.PageBase); err != nil {
fmt.Println(err)
}
} else {
server.Error404(w, r)
}