diff --git a/.gopmfile b/.gopmfile index 49b4171550..7fb407d165 100644 --- a/.gopmfile +++ b/.gopmfile @@ -6,9 +6,8 @@ github.com/beego/memcache = commit:2aea774416 github.com/beego/redigo = commit:856744a0d5 github.com/Unknwon/cae = commit:2e70a1351b github.com/Unknwon/com = -github.com/Unknwon/goconfig = commit:0f8d8dc1c0 github.com/Unknwon/i18n = commit:aec5f77857 -github.com/Unknwon/macaron = commit:3d307c1232 +github.com/Unknwon/macaron = github.com/codegangsta/cli = commit:7381bc4e62 github.com/go-sql-driver/mysql = commit:8111ee3ec3 github.com/go-xorm/core = commit:3e0fa232ab @@ -20,9 +19,9 @@ github.com/macaron-contrib/binding = github.com/macaron-contrib/cache = commit:0bb9e6c9ef github.com/macaron-contrib/captcha = commit:3567dc48b8 github.com/macaron-contrib/csrf = commit:422b79675c -github.com/macaron-contrib/i18n = commit:184bb832f2 +github.com/macaron-contrib/i18n = github.com/macaron-contrib/oauth2 = commit:8f394c3629 -github.com/macaron-contrib/session = commit:f00d48fd4f +github.com/macaron-contrib/session = github.com/macaron-contrib/toolbox = commit:57127bcc89 github.com/mattn/go-sqlite3 = commit:a80c27ba33 github.com/nfnt/resize = commit:581d15cb53 diff --git a/cmd/web.go b/cmd/web.go index 2251ea9218..56df5fe721 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -133,10 +133,7 @@ func newMacaron() *macaron.Macaron { m.Use(captcha.Captchaer(captcha.Options{ SubURL: setting.AppSubUrl, })) - m.Use(session.Sessioner(session.Options{ - Provider: setting.SessionProvider, - Config: *setting.SessionConfig, - })) + m.Use(session.Sessioner(setting.SessionConfig)) m.Use(csrf.Csrfer(csrf.Options{ Secret: setting.SecretKey, SetCookie: true, diff --git a/modules/setting/setting.go b/modules/setting/setting.go index 76e1ab7696..cda50b8e98 100644 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -104,8 +104,7 @@ var ( EnableMemcache bool // Session settings. - SessionProvider string - SessionConfig *session.Config + SessionConfig session.Options // Git settings. MaxGitDiffLines int @@ -412,22 +411,15 @@ func newCacheService() { } func newSessionService() { - SessionProvider = Cfg.MustValueRange("session", "PROVIDER", "memory", + SessionConfig.Provider = Cfg.MustValueRange("session", "PROVIDER", "memory", []string{"memory", "file", "redis", "mysql"}) - - SessionConfig = new(session.Config) SessionConfig.ProviderConfig = strings.Trim(Cfg.MustValue("session", "PROVIDER_CONFIG"), "\" ") SessionConfig.CookieName = Cfg.MustValue("session", "COOKIE_NAME", "i_like_gogits") SessionConfig.CookiePath = AppSubUrl 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.Maxlifetime = Cfg.MustInt64("session", "SESSION_LIFE_TIME", 86400) - if SessionProvider == "file" { - os.MkdirAll(path.Dir(SessionConfig.ProviderConfig), os.ModePerm) - } - log.Info("Session Service Enabled") } diff --git a/routers/admin/admin.go b/routers/admin/admin.go index 99bae8819a..563a9cdc41 100644 --- a/routers/admin/admin.go +++ b/routers/admin/admin.go @@ -202,7 +202,6 @@ func Config(ctx *middleware.Context) { ctx.Data["CacheInternal"] = setting.CacheInternal ctx.Data["CacheConn"] = setting.CacheConn - ctx.Data["SessionProvider"] = setting.SessionProvider ctx.Data["SessionConfig"] = setting.SessionConfig ctx.Data["PictureService"] = setting.PictureService diff --git a/templates/admin/config.tmpl b/templates/admin/config.tmpl index 3ccb106bc4..9dd25081ac 100644 --- a/templates/admin/config.tmpl +++ b/templates/admin/config.tmpl @@ -169,13 +169,11 @@
{{.SessionConfig.ProviderConfig}}