This commit is contained in:
parent
7e15298175
commit
8a69473baf
|
@ -120,7 +120,7 @@ func main() {
|
||||||
Backend: backend.(*memoryBackend),
|
Backend: backend.(*memoryBackend),
|
||||||
})
|
})
|
||||||
|
|
||||||
handler := server.NewMicrosubHandler(backend, pool)
|
handler := server.NewMicrosubHandler(backend)
|
||||||
if authEnabled {
|
if authEnabled {
|
||||||
handler = WithAuth(handler, backend.(*memoryBackend))
|
handler = WithAuth(handler, backend.(*memoryBackend))
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,12 +22,9 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
|
||||||
"regexp"
|
"regexp"
|
||||||
|
|
||||||
"p83.nl/go/ekster/pkg/microsub"
|
"p83.nl/go/ekster/pkg/microsub"
|
||||||
|
|
||||||
"github.com/gomodule/redigo/redis"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -36,18 +33,13 @@ var (
|
||||||
|
|
||||||
type microsubHandler struct {
|
type microsubHandler struct {
|
||||||
backend microsub.Microsub
|
backend microsub.Microsub
|
||||||
pool *redis.Pool
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewMicrosubHandler(backend microsub.Microsub, pool *redis.Pool) http.Handler {
|
func NewMicrosubHandler(backend microsub.Microsub) http.Handler {
|
||||||
return µsubHandler{backend, pool}
|
return µsubHandler{backend}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *microsubHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
func (h *microsubHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
var logger = log.New(os.Stdout, "logger: ", log.Lshortfile)
|
|
||||||
conn := redis.NewLoggingConn(h.pool.Get(), logger, "microsub")
|
|
||||||
defer conn.Close()
|
|
||||||
|
|
||||||
r.ParseForm()
|
r.ParseForm()
|
||||||
log.Printf("%s %s\n", r.Method, r.URL)
|
log.Printf("%s %s\n", r.Method, r.URL)
|
||||||
log.Println(r.URL.Query())
|
log.Println(r.URL.Query())
|
||||||
|
|
Loading…
Reference in New Issue
Block a user