diff options
author | Unknwon <joe2010xtmf@163.com> | 2014-07-31 17:25:34 -0400 |
---|---|---|
committer | Unknwon <joe2010xtmf@163.com> | 2014-07-31 17:25:34 -0400 |
commit | 7bbf644dd5eaca77c3e8df57419180486bda0fc2 (patch) | |
tree | 84033fb9507c4657d74b85dccd5f16595f8517a8 /modules/setting | |
parent | 3428baa3b57b39f2e010254bffede93e7d3cdf37 (diff) | |
download | gitea-7bbf644dd5eaca77c3e8df57419180486bda0fc2.tar.gz gitea-7bbf644dd5eaca77c3e8df57419180486bda0fc2.zip |
Convert captcha, cache, csrf as middlewares
Diffstat (limited to 'modules/setting')
-rw-r--r-- | modules/setting/setting.go | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/modules/setting/setting.go b/modules/setting/setting.go index dbd01051bf..24d041eae5 100644 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -16,8 +16,6 @@ import ( "github.com/Unknwon/goconfig" "github.com/macaron-contrib/session" - "github.com/gogits/cache" - "github.com/gogits/gogs/modules/log" // "github.com/gogits/gogs-ng/modules/ssh" ) @@ -80,9 +78,9 @@ var ( AttachmentEnabled bool // Cache settings. - Cache cache.Cache - CacheAdapter string - CacheConfig string + CacheAdapter string + CacheInternal int + CacheConn string EnableRedis bool EnableMemcache bool @@ -325,20 +323,13 @@ func newCacheService() { switch CacheAdapter { case "memory": - CacheConfig = fmt.Sprintf(`{"interval":%d}`, Cfg.MustInt("cache", "INTERVAL", 60)) + CacheInternal = Cfg.MustInt("cache", "INTERVAL", 60) case "redis", "memcache": - CacheConfig = fmt.Sprintf(`{"conn":"%s"}`, strings.Trim(Cfg.MustValue("cache", "HOST"), "\" ")) + CacheConn = strings.Trim(Cfg.MustValue("cache", "HOST"), "\" ") default: log.Fatal(4, "Unknown cache adapter: %s", CacheAdapter) } - var err error - Cache, err = cache.NewCache(CacheAdapter, CacheConfig) - if err != nil { - log.Fatal(4, "Init cache system failed, adapter: %s, config: %s, %v\n", - CacheAdapter, CacheConfig, err) - } - log.Info("Cache Service Enabled") } |