summaryrefslogtreecommitdiffstats
path: root/modules/setting/session.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/setting/session.go')
-rw-r--r--modules/setting/session.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/modules/setting/session.go b/modules/setting/session.go
index 97ac50d861..313c3c76b5 100644
--- a/modules/setting/session.go
+++ b/modules/setting/session.go
@@ -5,11 +5,15 @@
package setting
import (
+ "encoding/json"
"path"
"path/filepath"
"strings"
"code.gitea.io/gitea/modules/log"
+ // This ensures that VirtualSessionProvider is available
+ _ "code.gitea.io/gitea/modules/session"
+
"github.com/go-macaron/session"
)
@@ -31,5 +35,12 @@ func newSessionService() {
SessionConfig.Gclifetime = Cfg.Section("session").Key("GC_INTERVAL_TIME").MustInt64(86400)
SessionConfig.Maxlifetime = Cfg.Section("session").Key("SESSION_LIFE_TIME").MustInt64(86400)
+ shadowConfig, err := json.Marshal(SessionConfig)
+ if err != nil {
+ log.Fatal("Can't shadow session config: %v", err)
+ }
+ SessionConfig.ProviderConfig = string(shadowConfig)
+ SessionConfig.Provider = "VirtualSession"
+
log.Info("Session Service Enabled")
}