Open hochhaus opened 7 years ago
I've managed to set up postgres as backend for sessions.
Here's what I've had to do:
diff --git a/internal/conf/conf.go b/internal/conf/conf.go
index 9ba14f38..ddef312f 100644
--- a/internal/conf/conf.go
+++ b/internal/conf/conf.go
@@ -17,6 +17,7 @@ import (
_ "github.com/go-macaron/cache/memcache"
_ "github.com/go-macaron/cache/redis"
_ "github.com/go-macaron/session/redis"
+ _ "github.com/go-macaron/session/postgres"
"github.com/gogs/go-libravatar"
"github.com/mcuadros/go-version"
"github.com/pkg/errors"
--
2.25.0
Without that I've been getting error: panic: session: unknown provider 'postgres'(forgotten import?)
CREATE TABLE session (
key CHAR(16) NOT NULL,
data BYTEA,
expiry INTEGER NOT NULL,
PRIMARY KEY (key)
);
[session]
PROVIDER = postgres
PROVIDER_CONFIG = user=gogs password=p@ssw0rd host=mypostgres.local port=5432 dbname=gogs sslmode=verify-full
The session provider currently supports memory, file, redis and mysql. This issue is a feature request to add postgres support as well.
Postgres is supported upstream. Therefore, I suspect this feature addition should be a relatively minor change.