Skip to content

Commit

Permalink
adds exceptions for golangci lint
Browse files Browse the repository at this point in the history
  • Loading branch information
timbastin committed Feb 11, 2024
1 parent da90926 commit 6b9e376
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
5 changes: 0 additions & 5 deletions bouncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,13 @@ import (
"net/http"
"os"

"strings"

"log/slog"

"github.com/l3montree-dev/traefik-crowdsec-bouncer/config"
"github.com/l3montree-dev/traefik-crowdsec-bouncer/controller"
"github.com/lmittmann/tint"
)

var logLevel = config.OptionalEnv("CROWDSEC_BOUNCER_LOG_LEVEL", "1")
var trustedProxiesList = strings.Split(config.OptionalEnv("TRUSTED_PROXIES", "0.0.0.0/0"), ",")

func getLogLevel() slog.Level {
envVar := os.Getenv("LOG_LEVEL")
if envVar == "" {
Expand Down
6 changes: 3 additions & 3 deletions controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,10 +247,10 @@ func ForwardAuth(w http.ResponseWriter, r *http.Request) {
if err != nil {
slog.Warn("an error occured while checking IP", "err", err, "ip", clientIP)
w.WriteHeader(crowdsecBanResponseCode)
w.Write([]byte(crowdsecBanResponseMsg))
w.Write([]byte(crowdsecBanResponseMsg)) // nolint
} else if !isAuthorized {
w.WriteHeader(crowdsecBanResponseCode)
w.Write([]byte(crowdsecBanResponseMsg))
w.Write([]byte(crowdsecBanResponseMsg)) // nolint

} else {
w.WriteHeader(http.StatusOK)
Expand All @@ -274,7 +274,7 @@ func Healthz(w http.ResponseWriter, r *http.Request) {
Simple route responding pong to every request. Mainly use for Kubernetes liveliness probe
*/
func Ping(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("pong"))
w.Write([]byte("pong")) // nolint
}

func Metrics(w http.ResponseWriter, r *http.Request) {
Expand Down

0 comments on commit 6b9e376

Please sign in to comment.