mirror of
https://github.com/aljazceru/njump.git
synced 2025-12-18 14:54:24 +01:00
organize middleware a little more.
This commit is contained in:
15
main.go
15
main.go
@@ -38,21 +38,6 @@ var (
|
||||
tailwindDebugStuff template.HTML
|
||||
)
|
||||
|
||||
func loggingMiddleware(next http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
fullURL := fmt.Sprintf("%s://%s%s", r.Proto, r.Host, r.URL.Path)
|
||||
if r.URL.RawQuery != "" {
|
||||
fullURL += "?" + r.URL.RawQuery
|
||||
}
|
||||
log.Debug().Str("Full URL:", fullURL).Msg("Request URL => ")
|
||||
log.Debug().Str("ip", r.Header.Get("X-Forwarded-For")).
|
||||
Str("user-agent", r.Header.Get("User-Agent")).Str("referer", r.Header.Get("Referer")).Msg("Request details => ")
|
||||
|
||||
// Call the next handler in the chain
|
||||
next.ServeHTTP(w, r)
|
||||
})
|
||||
}
|
||||
|
||||
func main() {
|
||||
err := envconfig.Process("", &s)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user