-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
environment-to-ini does not work with INSTALL_LOCK #25924
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
Comments
Thank you for the detailed report. Will fix it soon. |
silverwind
pushed a commit
that referenced
this issue
Jul 17, 2023
Regression of #25648, fix #25924 Test: ```bash rm -f /tmp/example.ini /tmp/out.ini && \ echo "[security]" > /tmp/example.ini && \ echo "INSTALL_LOCK = true" >> /tmp/example.ini && \ GITEA__foo__bar=1 go run contrib/environment-to-ini/environment-to-ini.go --config=/tmp/example.ini --out=/tmp/out.ini && \ echo "==== example:" && \ cat /tmp/example.ini && \ echo "==== out:" && \ cat /tmp/out.ini ``` Output: ``` 2023/07/17 17:40:51 ...nvironment-to-ini.go:99:runEnvironmentToIni() [I] Settings saved to: "/tmp/out.ini" ==== example: [security] INSTALL_LOCK = true ==== out: [security] INSTALL_LOCK = true [foo] bar = 1 ```
GiteaBot
pushed a commit
to GiteaBot/gitea
that referenced
this issue
Jul 17, 2023
Regression of go-gitea#25648, fix go-gitea#25924 Test: ```bash rm -f /tmp/example.ini /tmp/out.ini && \ echo "[security]" > /tmp/example.ini && \ echo "INSTALL_LOCK = true" >> /tmp/example.ini && \ GITEA__foo__bar=1 go run contrib/environment-to-ini/environment-to-ini.go --config=/tmp/example.ini --out=/tmp/out.ini && \ echo "==== example:" && \ cat /tmp/example.ini && \ echo "==== out:" && \ cat /tmp/out.ini ``` Output: ``` 2023/07/17 17:40:51 ...nvironment-to-ini.go:99:runEnvironmentToIni() [I] Settings saved to: "/tmp/out.ini" ==== example: [security] INSTALL_LOCK = true ==== out: [security] INSTALL_LOCK = true [foo] bar = 1 ```
jolheiser
pushed a commit
that referenced
this issue
Jul 17, 2023
Co-authored-by: wxiaoguang <[email protected]> fix #25924
Could you try the nightly build (tag: |
Thanks a lot. I can confirm that the issue is fixed in both |
project-mirrors-bot-tu bot
pushed a commit
to project-mirrors/forgejo-as-gitea-fork
that referenced
this issue
Jan 23, 2025
…o-gitea#25937) Co-authored-by: wxiaoguang <[email protected]> fix go-gitea#25924 (cherry picked from commit d032500)
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Description
Running
environment-to-ini
on a partial config file will not apply environment variables if the source file hasINSTALL_LOCK = true
. This is a change in behavior to previous versions of the Gitea docker image.Reproducable Example
Given this
example.ini
run
export GITEA__database__DB_TYPE=postgres environment-to-ini --config=example.init --out=out.ini cat out.ini
Actual result:
Expected result:
Workaround
For Gitea v1.20.0 a possible workaround is to set
GITEA__security__INSTALL_LOCK=true
in the environment and haveINSTALL_LOCK = false
(or absent) in the source config. This results in the desired configuration.Additional Details
As mentioned above this behavior is new in Gitea v1.20.0. Previous versions produced the expected result. I suspect that #25330 caused the change of behavior but haven't checked thoroughly.
The issue seems to be caused by
setting.InitWorkPathAndCfgProvider(…)
which is called byenvironment-to-ini
to load the existing config file. That function then clears the environment, causingenvironment-to-ini
not to perform any changes.gitea/modules/setting/path.go
Lines 174 to 176 in 81a8120
This bug report is specific to
environment-to-ini
so the rest of this form only partially applies.Gitea Version
v1.20.0
Can you reproduce the bug on the Gitea demo site?
No
Log Gist
no logs produced / does not apply
Screenshots
No response
Git Version
2.40.1
Operating System
Alpine Linux v3.18 (official docker image) on Fedora 38 (host)
How are you running Gitea?
This bug is specific to
environment-from-ini
and occurs before Gitea actually starts.I run Gitea via the official docker image
gitea/gitea:1.20.0-rootless
. Starting this image with an interactive shell allows you to reproduce the issue.Alternatively run
Database
PostgreSQL
The text was updated successfully, but these errors were encountered: