Skip to content

Commit

Permalink
Show only needed values in database configuration section depending o…
Browse files Browse the repository at this point in the history
…n type (go-gitea#4164)
  • Loading branch information
lafriks authored and lunny committed Jun 6, 2018
1 parent e5fd43c commit a89d625
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 0 additions & 2 deletions options/locale/locale_en-US.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 8 additions & 2 deletions templates/admin/config.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down

0 comments on commit a89d625

Please sign in to comment.