1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

Make "install page" respect environment config (#25648)

Replace #25580

Fix #19453

The problem was: when users set "GITEA__XXX__YYY" , the "install page"
doesn't respect it.

So, to make the result consistent and avoid surprising end users, now
the "install page" also writes the environment variables to the config
file.

And, to make things clear, there are enough messages on the UI to tell
users what will happen.

There are some necessary/related changes to `environment-to-ini.go`:

* The "--clear" flag is removed and it was incorrectly written there.
The "clear" operation should be done if INSTALL_LOCK=true
* The "--prefix" flag is removed because it's never used, never
documented and it only causes inconsistent behavior.


![image](https://github.com/go-gitea/gitea/assets/2114189/12778ee4-3fb5-4664-a73a-41ebbd77cd5b)
This commit is contained in:
wxiaoguang
2023-07-10 06:43:37 +08:00
committed by GitHub
parent 61e0d1a767
commit fa0b5b14c2
13 changed files with 86 additions and 72 deletions

View File

@@ -1,6 +1,6 @@
{{template "base/head" .}}
<div role="main" aria-label="{{.Title}}" class="page-content install">
<div class="ui middle very relaxed page grid">
<div class="ui grid install-config-container">
<div class="sixteen wide center aligned centered column">
<h3 class="ui top attached header">
{{.locale.Tr "install.title"}}
@@ -149,7 +149,7 @@
</div>
<div class="inline field">
<div class="ui checkbox">
<label for="enable_update_checker">{{.locale.Tr "install.enable_update_checker"}}</label>
<label>{{.locale.Tr "install.enable_update_checker"}}</label>
<input name="enable_update_checker" type="checkbox">
</div>
<span class="help">{{.locale.Tr "install.enable_update_checker_helper"}}</span>
@@ -160,7 +160,7 @@
<!-- Email -->
<details class="optional field">
<summary class="title gt-py-3{{if .Err_SMTP}} text red{{end}}">
<summary class="right-content gt-py-3{{if .Err_SMTP}} text red{{end}}">
{{.locale.Tr "install.email_title"}}
</summary>
<div class="inline field">
@@ -200,7 +200,7 @@
<!-- Server and other services -->
<details class="optional field">
<summary class="title gt-py-3{{if .Err_Services}} text red{{end}}">
<summary class="right-content gt-py-3{{if .Err_Services}} text red{{end}}">
{{.locale.Tr "install.server_service_title"}}
</summary>
<div class="inline field">
@@ -298,7 +298,7 @@
<!-- Admin -->
<details class="optional field">
<summary class="title gt-py-3{{if .Err_Admin}} text red{{end}}">
<summary class="right-content gt-py-3{{if .Err_Admin}} text red{{end}}">
{{.locale.Tr "install.admin_title"}}
</summary>
<p class="center">{{.locale.Tr "install.admin_setting_desc"}}</p>
@@ -320,10 +320,27 @@
</div>
</details>
{{if .EnvConfigKeys}}
<!-- Environment Config -->
<h4 class="ui dividing header">{{.locale.Tr "install.env_config_keys"}}</h4>
<div class="inline field">
<div class="right-content">
{{.locale.Tr "install.env_config_keys_prompt"}}
</div>
<div class="right-content gt-mt-3">
{{range .EnvConfigKeys}}<span class="ui label">{{.}}</span>{{end}}
</div>
</div>
{{end}}
<div class="divider"></div>
<div class="inline field">
<label></label>
<button class="ui primary button">{{.locale.Tr "install.install_btn_confirm"}}</button>
<div class="right-content">
These configuration options will be written into: {{.CustomConfFile}}
</div>
<div class="right-content gt-mt-3">
<button class="ui primary button">{{.locale.Tr "install.install_btn_confirm"}}</button>
</div>
</div>
</form>
</div>