aboutsummaryrefslogtreecommitdiff
path: root/cmd/server/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/server/main.go')
-rw-r--r--cmd/server/main.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/cmd/server/main.go b/cmd/server/main.go
index 21f7031..912cba0 100644
--- a/cmd/server/main.go
+++ b/cmd/server/main.go
@@ -6,6 +6,8 @@ import (
"log"
"net/http"
"os"
+ "strings"
+ "text/template"
"time"
"github.com/gomodule/redigo/redis"
@@ -73,6 +75,11 @@ func main() { //nolint:funlen
MaxActive: 12000, //nolint:gomnd
Dial: func() (redis.Conn, error) {
c, err := redis.Dial("tcp", *redisAddr)
+
+ if strings.HasPrefix(*redisAddr, "unix:") {
+ c, err = redis.Dial("unix", strings.TrimPrefix(*redisAddr, "unix:"))
+ }
+
if err != nil {
log.Println("Redis dial error: ", err)
}
@@ -87,6 +94,10 @@ func main() { //nolint:funlen
os.Stderr.Write(b)
}
+ page.Funcs = template.FuncMap{
+ "ClearRedis": app.ClearRedis,
+ }
+
srv := &http.Server{
Handler: app,
Addr: *listen,