Show only needed values in database configuration section depending on type (#4164)

release/v1.15
Lauris BH 2018-06-07 02:13:42 +03:00 committed by Lunny Xiao
parent e5fd43c231
commit a89d6253e0
2 changed files with 8 additions and 4 deletions

View File

@ -1475,9 +1475,7 @@ config.db_host = Host
config.db_name = Name
config.db_user = Username
config.db_ssl_mode = SSL
config.db_ssl_mode_helper = (for "postgres" only)
config.db_path = Path
config.db_path_helper = (for "sqlite3" and "tidb")
config.service_config = Service Configuration
config.register_email_confirm = Require Email Confirmation to Register

View File

@ -92,16 +92,22 @@
<dl class="dl-horizontal admin-dl-horizontal">
<dt>{{.i18n.Tr "admin.config.db_type"}}</dt>
<dd>{{.DbCfg.Type}}</dd>
{{if not (or (eq .DbCfg.Type "sqlite3") (eq .DbCfg.Type "tidb"))}}
<dt>{{.i18n.Tr "admin.config.db_host"}}</dt>
<dd>{{if .DbCfg.Host}}{{.DbCfg.Host}}{{else}}-{{end}}</dd>
<dt>{{.i18n.Tr "admin.config.db_name"}}</dt>
<dd>{{if .DbCfg.Name}}{{.DbCfg.Name}}{{else}}-{{end}}</dd>
<dt>{{.i18n.Tr "admin.config.db_user"}}</dt>
<dd>{{if .DbCfg.User}}{{.DbCfg.User}}{{else}}-{{end}}</dd>
{{end}}
{{if eq .DbCfg.Type "postgres"}}
<dt>{{.i18n.Tr "admin.config.db_ssl_mode"}}</dt>
<dd>{{if .DbCfg.SSLMode}}{{.DbCfg.SSLMode}}{{else}}-{{end}} {{.i18n.Tr "admin.config.db_ssl_mode_helper"}}</dd>
<dd>{{if .DbCfg.SSLMode}}{{.DbCfg.SSLMode}}{{else}}-{{end}}</dd>
{{end}}
{{if or (eq .DbCfg.Type "sqlite3") (eq .DbCfg.Type "tidb")}}
<dt>{{.i18n.Tr "admin.config.db_path"}}</dt>
<dd>{{if .DbCfg.Path}}{{.DbCfg.Path}}{{else}}-{{end}} {{.i18n.Tr "admin.config.db_path_helper"}}</dd>
<dd>{{if .DbCfg.Path}}{{.DbCfg.Path}}{{else}}-{{end}}</dd>
{{end}}
</dl>
</div>