Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace the redigo with go-redis as the store component of redis session #190

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ go 1.21

require (
github.com/fsnotify/fsnotify v1.7.0
github.com/no-src/gin-session-redis v0.0.0-20230607000019-22f0f8e8d226
github.com/gin-contrib/gzip v1.0.1
github.com/gin-contrib/pprof v1.5.0
github.com/gin-contrib/sessions v1.0.1
Expand Down Expand Up @@ -67,6 +68,7 @@ require (
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/no-src/redistore v0.0.0-20230606141741-b5d82a351724 // indirect
github.com/onsi/ginkgo/v2 v2.9.5 // indirect
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
github.com/quasoft/memstore v0.0.0-20191010062613-2bce066d2b0b // indirect
Expand Down
6 changes: 6 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,12 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/no-src/gin-session-redis v0.0.0-20230607000019-22f0f8e8d226 h1:gc/AvmXp+gYGajlbeli57rG8dXZ5f23ad6obPqeMeFw=
github.com/no-src/gin-session-redis v0.0.0-20230607000019-22f0f8e8d226/go.mod h1:SaVF/hVQQyQqiMax51BKpyzO0b3rSaIA5x1d74dL+Ws=
github.com/no-src/nscache v0.1.1 h1:gs9hJ4Y5CaeLRmexvE4Rto6Gnjf5maKoTxFnssXAuJE=
github.com/no-src/nscache v0.1.1/go.mod h1:b8MdbvnxTwjlmyszbysVX/4/cZKk/rWvtW2RnQI7uSQ=
github.com/no-src/redistore v0.0.0-20230606141741-b5d82a351724 h1:kV1S+4QCoXub9DWY7Rk/I3G57TBTLm/HahrkN5PiUbI=
github.com/no-src/redistore v0.0.0-20230606141741-b5d82a351724/go.mod h1:qQWe19kDd0yWtU42aVM+qCKVShw38y13ql0S/ZGAg+M=
github.com/no-src/fsctl v0.1.3 h1:s7SZ+amki9HSLFXIAKOXMFLDKFJQT+injSz5DMufSt4=
github.com/no-src/fsctl v0.1.3/go.mod h1:MmoS6tsvDES/goCcJqap5eUZTXlkmW77vsZb7kx9wMY=
github.com/no-src/log v0.3.1 h1:HvozFJQwRicaCThaRztVNOACR01jMiK8Upn4eU7lyps=
Expand Down
4 changes: 2 additions & 2 deletions server/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

"github.com/gin-contrib/sessions"
"github.com/gin-contrib/sessions/memstore"
"github.com/gin-contrib/sessions/redis"
"github.com/no-src/gin-session-redis/redis"
)

var (
Expand Down Expand Up @@ -51,7 +51,7 @@
}
// get the existing secret in the redis, if not exist, set the new secret
// TODO
return redis.NewStoreWithDB(maxIdle, network, address, password, strconv.Itoa(db), secret)
return redis.NewStoreWithDB(maxIdle, network, address, password, db, secret)

Check warning on line 54 in server/session.go

View check run for this annotation

Codecov / codecov/patch

server/session.go#L54

Added line #L54 was not covered by tests
}

// parseRedisConnection parse the redis connection string
Expand Down
Loading