aboutsummaryrefslogtreecommitdiffstats
path: root/routers/routes/routes.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2020-01-29 15:47:46 +0800
committerGitHub <noreply@github.com>2020-01-29 09:47:46 +0200
commit79ce91fddee549514c98f002b719fc8cda0e380f (patch)
tree56271e8e73b238bfee415a64d73d1272c67fef3a /routers/routes/routes.go
parentc09e020558318feebbdce477f91c94411e8959b6 (diff)
downloadgitea-79ce91fddee549514c98f002b719fc8cda0e380f.tar.gz
gitea-79ce91fddee549514c98f002b719fc8cda0e380f.zip
Movde dependents on macaron from modules/setting (#10050)
Co-authored-by: Lauris BH <lauris@nix.lv>
Diffstat (limited to 'routers/routes/routes.go')
-rw-r--r--routers/routes/routes.go22
1 files changed, 19 insertions, 3 deletions
diff --git a/routers/routes/routes.go b/routers/routes/routes.go
index 693f33fddb..a06eb46ad1 100644
--- a/routers/routes/routes.go
+++ b/routers/routes/routes.go
@@ -201,7 +201,16 @@ func NewMacaron() *macaron.Macaron {
m.Use(captcha.Captchaer(captcha.Options{
SubURL: setting.AppSubURL,
}))
- m.Use(session.Sessioner(setting.SessionConfig))
+ m.Use(session.Sessioner(session.Options{
+ Provider: setting.SessionConfig.Provider,
+ ProviderConfig: setting.SessionConfig.ProviderConfig,
+ CookieName: setting.SessionConfig.CookieName,
+ CookiePath: setting.SessionConfig.CookiePath,
+ Gclifetime: setting.SessionConfig.Gclifetime,
+ Maxlifetime: setting.SessionConfig.Maxlifetime,
+ Secure: setting.SessionConfig.Secure,
+ Domain: setting.SessionConfig.Domain,
+ }))
m.Use(csrf.Csrfer(csrf.Options{
Secret: setting.SecretKey,
Cookie: setting.CSRFCookieName,
@@ -963,8 +972,15 @@ func RegisterRoutes(m *macaron.Macaron) {
}
var handlers []macaron.Handler
- if setting.EnableCORS {
- handlers = append(handlers, cors.CORS(setting.CORSConfig))
+ if setting.CORSConfig.Enabled {
+ handlers = append(handlers, cors.CORS(cors.Options{
+ Scheme: setting.CORSConfig.Scheme,
+ AllowDomain: setting.CORSConfig.AllowDomain,
+ AllowSubdomain: setting.CORSConfig.AllowSubdomain,
+ Methods: setting.CORSConfig.Methods,
+ MaxAgeSeconds: int(setting.CORSConfig.MaxAge.Seconds()),
+ AllowCredentials: setting.CORSConfig.AllowCredentials,
+ }))
}
handlers = append(handlers, ignSignIn)
m.Group("/api", func() {