|
@ -104,8 +104,7 @@ var ( |
|
|
EnableMemcache bool |
|
|
EnableMemcache bool |
|
|
|
|
|
|
|
|
// Session settings.
|
|
|
// Session settings.
|
|
|
SessionProvider string |
|
|
|
|
|
SessionConfig *session.Config |
|
|
|
|
|
|
|
|
SessionConfig session.Options |
|
|
|
|
|
|
|
|
// Git settings.
|
|
|
// Git settings.
|
|
|
MaxGitDiffLines int |
|
|
MaxGitDiffLines int |
|
@ -412,22 +411,15 @@ func newCacheService() { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func newSessionService() { |
|
|
func newSessionService() { |
|
|
SessionProvider = Cfg.MustValueRange("session", "PROVIDER", "memory", |
|
|
|
|
|
|
|
|
SessionConfig.Provider = Cfg.MustValueRange("session", "PROVIDER", "memory", |
|
|
[]string{"memory", "file", "redis", "mysql"}) |
|
|
[]string{"memory", "file", "redis", "mysql"}) |
|
|
|
|
|
|
|
|
SessionConfig = new(session.Config) |
|
|
|
|
|
SessionConfig.ProviderConfig = strings.Trim(Cfg.MustValue("session", "PROVIDER_CONFIG"), "\" ") |
|
|
SessionConfig.ProviderConfig = strings.Trim(Cfg.MustValue("session", "PROVIDER_CONFIG"), "\" ") |
|
|
SessionConfig.CookieName = Cfg.MustValue("session", "COOKIE_NAME", "i_like_gogits") |
|
|
SessionConfig.CookieName = Cfg.MustValue("session", "COOKIE_NAME", "i_like_gogits") |
|
|
SessionConfig.CookiePath = AppSubUrl |
|
|
SessionConfig.CookiePath = AppSubUrl |
|
|
SessionConfig.Secure = Cfg.MustBool("session", "COOKIE_SECURE") |
|
|
SessionConfig.Secure = Cfg.MustBool("session", "COOKIE_SECURE") |
|
|
SessionConfig.EnableSetCookie = Cfg.MustBool("session", "ENABLE_SET_COOKIE", true) |
|
|
|
|
|
SessionConfig.Gclifetime = Cfg.MustInt64("session", "GC_INTERVAL_TIME", 86400) |
|
|
SessionConfig.Gclifetime = Cfg.MustInt64("session", "GC_INTERVAL_TIME", 86400) |
|
|
SessionConfig.Maxlifetime = Cfg.MustInt64("session", "SESSION_LIFE_TIME", 86400) |
|
|
SessionConfig.Maxlifetime = Cfg.MustInt64("session", "SESSION_LIFE_TIME", 86400) |
|
|
|
|
|
|
|
|
if SessionProvider == "file" { |
|
|
|
|
|
os.MkdirAll(path.Dir(SessionConfig.ProviderConfig), os.ModePerm) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
log.Info("Session Service Enabled") |
|
|
log.Info("Session Service Enabled") |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|