[CHORE] Move to new sessioner library

- Moves to a fork of gitea.com/go-chi/session that removed support for
couchbase (and ledis, but that was never made available in Forgejo)
along with other code improvements.
f8ce677595..main
- The rationale for removing Couchbase is quite simple. Its not licensed
under FOSS
license (https://www.couchbase.com/blog/couchbase-adopts-bsl-license/)
and therefore cannot be tested by Forgejo and shouldn't be supported.
This is a similair vein to the removal of MSSQL
support (https://codeberg.org/forgejo/discussions/issues/122)
- A additional benefit is that this reduces the Forgejo binary by ~600Kb.
This commit is contained in:
Gusted 2024-08-23 03:08:06 +02:00
parent e3243a9465
commit fc40a5e242
No known key found for this signature in database
GPG key ID: FD821B732837125F
16 changed files with 294 additions and 55 deletions

View file

@ -8,12 +8,12 @@ import (
"sync"
"code.gitea.io/gitea/modules/json"
"code.gitea.io/gitea/modules/log"
"gitea.com/go-chi/session"
couchbase "gitea.com/go-chi/session/couchbase"
memcache "gitea.com/go-chi/session/memcache"
mysql "gitea.com/go-chi/session/mysql"
postgres "gitea.com/go-chi/session/postgres"
"code.forgejo.org/go-chi/session"
memcache "code.forgejo.org/go-chi/session/memcache"
mysql "code.forgejo.org/go-chi/session/mysql"
postgres "code.forgejo.org/go-chi/session/postgres"
)
// VirtualSessionProvider represents a shadowed session provider implementation.
@ -35,6 +35,9 @@ func (o *VirtualSessionProvider) Init(gclifetime int64, config string) error {
switch opts.Provider {
case "memory":
o.provider = &session.MemProvider{}
case "couchbase":
log.Warn("Couchbase as session provider is no longer supported, falling back to file as session provider")
fallthrough
case "file":
o.provider = &session.FileProvider{}
case "redis":
@ -45,8 +48,6 @@ func (o *VirtualSessionProvider) Init(gclifetime int64, config string) error {
o.provider = &mysql.MysqlProvider{}
case "postgres":
o.provider = &postgres.PostgresProvider{}
case "couchbase":
o.provider = &couchbase.CouchbaseProvider{}
case "memcache":
o.provider = &memcache.MemcacheProvider{}
default: