From b90b0c1191c559a60d4f30633266fc4c0a76ae4b Mon Sep 17 00:00:00 2001 From: Gibheer Date: Fri, 30 Oct 2015 13:53:06 +0100 Subject: move minimum key sizes to config This moves the minimum key sizes into the config file, so that anyone can modify the restrictions. --- modules/setting/setting.go | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'modules/setting') diff --git a/modules/setting/setting.go b/modules/setting/setting.go index 88209b25b6..722287a07c 100644 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -434,6 +434,7 @@ var Service struct { EnableReverseProxyAuth bool EnableReverseProxyAutoRegister bool DisableMinimumKeySizeCheck bool + MinimumKeySizes map[string]int EnableCaptcha bool } @@ -449,6 +450,11 @@ func newService() { Service.EnableReverseProxyAutoRegister = sec.Key("ENABLE_REVERSE_PROXY_AUTO_REGISTRATION").MustBool() Service.DisableMinimumKeySizeCheck = sec.Key("DISABLE_MINIMUM_KEY_SIZE_CHECK").MustBool() Service.EnableCaptcha = sec.Key("ENABLE_CAPTCHA").MustBool() + + minimumKeySizes := Cfg.Section("service.minimum_key_sizes").Keys() + for _, key := range minimumKeySizes { + Service.MinimumKeySizes[key.Name()] = key.MustInt() + } } var logLevels = map[string]string{ -- cgit v1.2.3