mirror of
https://github.com/safing/portbase
synced 2025-09-16 10:09:49 +00:00
Add API Key auth and improve endpoints
This commit is contained in:
parent
8c6cb758f7
commit
11e8271d41
10 changed files with 529 additions and 164 deletions
|
@ -92,7 +92,6 @@ func (mh *mainHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||
func (mh *mainHandler) handle(w http.ResponseWriter, r *http.Request) error {
|
||||
// Setup context trace logging.
|
||||
ctx, tracer := log.AddTracer(r.Context())
|
||||
lrw := NewLoggingResponseWriter(w, r)
|
||||
// Add request context.
|
||||
apiRequest := &Request{
|
||||
Request: r,
|
||||
|
@ -100,6 +99,7 @@ func (mh *mainHandler) handle(w http.ResponseWriter, r *http.Request) error {
|
|||
ctx = context.WithValue(ctx, requestContextKey, apiRequest)
|
||||
// Add context back to request.
|
||||
r = r.WithContext(ctx)
|
||||
lrw := NewLoggingResponseWriter(w, r)
|
||||
|
||||
tracer.Tracef("api request: %s ___ %s", r.RemoteAddr, r.RequestURI)
|
||||
defer func() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue