aboutsummaryrefslogtreecommitdiff
path: root/modules/setting
diff options
context:
space:
mode:
Diffstat (limited to 'modules/setting')
-rw-r--r--modules/setting/setting.go43
1 files changed, 33 insertions, 10 deletions
diff --git a/modules/setting/setting.go b/modules/setting/setting.go
index 79001407..b2ab3b46 100644
--- a/modules/setting/setting.go
+++ b/modules/setting/setting.go
@@ -53,6 +53,7 @@ var (
HttpAddr, HttpPort string
DisableSSH bool
SSHPort int
+ SSHDomain string
OfflineMode bool
DisableRouterLog bool
CertFile, KeyFile string
@@ -84,6 +85,9 @@ var (
RepoRootPath string
ScriptType string
+ // UI settings.
+ IssuePagingNum int
+
// Picture settings.
PictureService string
AvatarUploadPath string
@@ -130,6 +134,9 @@ var (
// I18n settings.
Langs, Names []string
+ // Other settings.
+ ShowFooterBranding bool
+
// Global setting objects.
Cfg *ini.File
CustomPath string // Custom directory path.
@@ -229,6 +236,7 @@ func NewConfigContext() {
HttpAddr = sec.Key("HTTP_ADDR").MustString("0.0.0.0")
HttpPort = sec.Key("HTTP_PORT").MustString("3000")
DisableSSH = sec.Key("DISABLE_SSH").MustBool()
+ SSHDomain = sec.Key("SSH_DOMAIN").MustString(Domain)
SSHPort = sec.Key("SSH_PORT").MustInt(22)
OfflineMode = sec.Key("OFFLINE_MODE").MustBool()
DisableRouterLog = sec.Key("DISABLE_ROUTER_LOG").MustBool()
@@ -305,6 +313,9 @@ func NewConfigContext() {
}
ScriptType = sec.Key("SCRIPT_TYPE").MustString("bash")
+ // UI settings.
+ IssuePagingNum = Cfg.Section("ui").Key("ISSUE_PAGING_NUM").MustInt(10)
+
sec = Cfg.Section("picture")
PictureService = sec.Key("SERVICE").In("server", []string{"server"})
AvatarUploadPath = sec.Key("AVATAR_UPLOAD_PATH").MustString("data/avatars")
@@ -319,6 +330,9 @@ func NewConfigContext() {
GravatarSource = "//1.gravatar.com/avatar/"
}
DisableGravatar = sec.Key("DISABLE_GRAVATAR").MustBool()
+ if OfflineMode {
+ DisableGravatar = true
+ }
if err = Cfg.Section("git").MapTo(&Git); err != nil {
log.Fatal(4, "Fail to map Git settings: %v", err)
@@ -327,10 +341,14 @@ func NewConfigContext() {
Langs = Cfg.Section("i18n").Key("LANGS").Strings(",")
Names = Cfg.Section("i18n").Key("NAMES").Strings(",")
+ ShowFooterBranding = Cfg.Section("other").Key("SHOW_FOOTER_BRANDING").MustBool()
+
HasRobotsTxt = com.IsFile(path.Join(CustomPath, "robots.txt"))
}
var Service struct {
+ ActiveCodeLives int
+ ResetPwdCodeLives int
RegisterEmailConfirm bool
DisableRegistration bool
ShowRegistrationButton bool
@@ -339,19 +357,20 @@ var Service struct {
EnableNotifyMail bool
EnableReverseProxyAuth bool
EnableReverseProxyAutoRegister bool
- ActiveCodeLives int
- ResetPwdCodeLives int
+ DisableMinimumKeySizeCheck bool
}
func newService() {
- Service.ActiveCodeLives = Cfg.Section("service").Key("ACTIVE_CODE_LIVE_MINUTES").MustInt(180)
- Service.ResetPwdCodeLives = Cfg.Section("service").Key("RESET_PASSWD_CODE_LIVE_MINUTES").MustInt(180)
- Service.DisableRegistration = Cfg.Section("service").Key("DISABLE_REGISTRATION").MustBool()
- Service.ShowRegistrationButton = Cfg.Section("service").Key("SHOW_REGISTRATION_BUTTON").MustBool(!Service.DisableRegistration)
- Service.RequireSignInView = Cfg.Section("service").Key("REQUIRE_SIGNIN_VIEW").MustBool()
- Service.EnableCacheAvatar = Cfg.Section("service").Key("ENABLE_CACHE_AVATAR").MustBool()
- Service.EnableReverseProxyAuth = Cfg.Section("service").Key("ENABLE_REVERSE_PROXY_AUTHENTICATION").MustBool()
- Service.EnableReverseProxyAutoRegister = Cfg.Section("service").Key("ENABLE_REVERSE_PROXY_AUTO_REGISTRATION").MustBool()
+ sec := Cfg.Section("service")
+ Service.ActiveCodeLives = sec.Key("ACTIVE_CODE_LIVE_MINUTES").MustInt(180)
+ Service.ResetPwdCodeLives = sec.Key("RESET_PASSWD_CODE_LIVE_MINUTES").MustInt(180)
+ Service.DisableRegistration = sec.Key("DISABLE_REGISTRATION").MustBool()
+ Service.ShowRegistrationButton = sec.Key("SHOW_REGISTRATION_BUTTON").MustBool(!Service.DisableRegistration)
+ Service.RequireSignInView = sec.Key("REQUIRE_SIGNIN_VIEW").MustBool()
+ Service.EnableCacheAvatar = sec.Key("ENABLE_CACHE_AVATAR").MustBool()
+ Service.EnableReverseProxyAuth = sec.Key("ENABLE_REVERSE_PROXY_AUTHENTICATION").MustBool()
+ Service.EnableReverseProxyAutoRegister = sec.Key("ENABLE_REVERSE_PROXY_AUTO_REGISTRATION").MustBool()
+ Service.DisableMinimumKeySizeCheck = sec.Key("DISABLE_MINIMUM_KEY_SIZE_CHECK").MustBool()
}
var logLevels = map[string]string{
@@ -465,6 +484,8 @@ type Mailer struct {
Host string
From string
User, Passwd string
+ DisableHelo bool
+ HeloHostname string
SkipVerify bool
UseCertificate bool
CertFile, KeyFile string
@@ -499,6 +520,8 @@ func newMailService() {
Host: sec.Key("HOST").String(),
User: sec.Key("USER").String(),
Passwd: sec.Key("PASSWD").String(),
+ DisableHelo: sec.Key("DISABLE_HELO").MustBool(),
+ HeloHostname: sec.Key("HELO_HOSTNAME").String(),
SkipVerify: sec.Key("SKIP_VERIFY").MustBool(),
UseCertificate: sec.Key("USE_CERTIFICATE").MustBool(),
CertFile: sec.Key("CERT_FILE").String(),