Skip to content

Commit

Permalink
update doc strings
Browse files Browse the repository at this point in the history
  • Loading branch information
gi8lino committed Dec 21, 2023
1 parent e52c9e9 commit f9acf99
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (
)

const (
version = "v0.0.16"
version = "v0.0.17"
)

var (
Expand Down
14 changes: 13 additions & 1 deletion internal/server/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,19 @@ import (
"github.com/rs/zerolog/log"
)

// ApiTokenMiddleware checks for the presence and validity of the API token.
// ApiTokenMiddleware is a middleware function that checks for the presence and validity of the API token.
//
// Parameters:
// - next: http.HandlerFunc
// The next HTTP handler in the chain.
// - token: string
// The expected API token for authentication.
//
// Behavior:
//
// The middleware checks the 'X-API-Token' header in the incoming request against the provided token.
// If the header is missing or the token is invalid, it responds with an HTTP 401 Unauthorized status.
// If the token is valid, it calls the next handler in the chain.
func ApiTokenMiddleware(next http.HandlerFunc, token string) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
apiToken := r.Header.Get("X-API-Token")
Expand Down
1 change: 1 addition & 0 deletions internal/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/rs/zerolog/log"
)

// StaticFS is the embedded filesystem for static files.
var StaticFS embed.FS

// Run starts the HTTP server.
Expand Down

0 comments on commit f9acf99

Please sign in to comment.