Open zekiahmetbayar opened 11 months ago
Hey @hibiken, are you interested in this pr?
I think there are a lot of people who need it :) #78
Hey @hibiken, are you interested in this pr?
I think there are a lot of people who need it :) #78
thx for the PR. I think this should be merged but its the author's wish, however, I will be using this in my code. thx a lot
any update???
I've found another solution, without modifying the base code. Given the example with gorilla mux.
First - create asynqmon handler
var h = asynqmon.New(asynqmon.Options{
RootPath: "/monitoring",
RedisConnOpt: asynq.RedisClientOpt{
Addr: "localhost:6379",
DB: 0,
Password: "",
})
Second - create gorilla mux sub-router with your middleware and attach handler for that route.
monitoring := r.PathPrefix(h.RootPath()).Subrouter()
monitoring.Use(isAuthenticated, isAuthorised, exampleMiddleware)
monitoring.NewRoute().Handler(h)
[!IMPORTANT] It is important to use NewRoute(), in order to be able to attach he handler.
Bellow is the exampleMiddleware where you can add your logic.
var exampleMiddleware = func(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
allowed := true
if !allowed {
w.WriteHeader(http.StatusForbidden)
return
}
next.ServeHTTP(w, r.WithContext(ctx))
})
}
Hi,
I did not want everyone to read the data I wrote to the tasks, and encrypting and decrypting this data slowed down my application. For this reason, I researched whether there was a basic auth option and came across this. #78
When I saw that it was not yet available, I wanted to make an improvement for this application and I added basic auth.
Features: