From fc68fb951c179b125b37a83f9e0b5f8dde0478f8 Mon Sep 17 00:00:00 2001 From: Thibault Meyer <0xbaadf00d@users.noreply.github.com> Date: Wed, 10 Aug 2016 08:47:16 +0200 Subject: Feature #3398: Redefine global mirror interval (#3409) * add mirror::GLOBAL_INTERVAL on app.ini * rename key to DEFAULT_INTERVAL * add key on default app.ini + move code --- modules/setting/setting.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'modules') diff --git a/modules/setting/setting.go b/modules/setting/setting.go index a56c4824e9..787e2c81b0 100644 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -208,6 +208,10 @@ var ( } `ini:"git.timeout"` } + Mirror struct { + DefaultInterval int + } + // API settings API struct { MaxResponseItems int @@ -514,6 +518,12 @@ func NewContext() { log.Fatal(4, "Fail to map Git settings: %v", err) } else if err = Cfg.Section("api").MapTo(&API); err != nil { log.Fatal(4, "Fail to map API settings: %v", err) + } else if err = Cfg.Section("mirror").MapTo(&Mirror); err != nil { + log.Fatal(4, "Fail to map API settings: %v", err) + } + + if Mirror.DefaultInterval <= 0 { + Mirror.DefaultInterval = 24 } Langs = Cfg.Section("i18n").Key("LANGS").Strings(",") -- cgit v1.2.3