-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
The "install" or "ini save" writes garbage options to app.ini #25377
Comments
That's a longstanding INI package problem: the "MustXxx" calls change the option values, and the following "Save" will save a lot of garbage options into the user's config file. Ideally we should refactor the INI package to a clear solution, but it's a huge work. A clear workaround is what this PR does: when "Save", load a clear INI instance and save it. Partially fix #25377, the "install" page needs more fine tunes.
That's a longstanding INI package problem: the "MustXxx" calls change the option values, and the following "Save" will save a lot of garbage options into the user's config file. Ideally we should refactor the INI package to a clear solution, but it's a huge work. A clear workaround is what this PR does: when "Save", load a clear INI instance and save it. Partially fix go-gitea#25377, the "install" page needs more fine tunes.
Backport #25395 by @wxiaoguang That's a longstanding INI package problem: the "MustXxx" calls change the option values, and the following "Save" will save a lot of garbage options into the user's config file. Ideally we should refactor the INI package to a clear solution, but it's a huge work. A clear workaround is what this PR does: when "Save", load a clear INI instance and save it. Partially fix #25377, the "install" page needs more fine tunes. Co-authored-by: wxiaoguang <[email protected]>
Is this issue addressed? I've starting testing gitea v1.20.0-rc2 (which includes 8302b95) locally and have gotten these errors on startup:
In our config we set |
I do not think "/custom/conf/app.ini" is a right path for config file. How do you run Gitea? Can you provide reproducible steps? |
Paths are arbitrary and as far as I know Gitea doesn't actually care what the paths are. In our case we build our docker image with this Dockerfile: https://opendev.org/opendev/system-config/src/branch/master/docker/gitea/Dockerfile (modified to update the git tag checkout to v1.20.0-rc2 in this case) and deploy them with this docker-compose file: https://opendev.org/opendev/system-config/src/branch/master/playbooks/roles/gitea/templates/docker-compose.yaml.j2
I believe that there are two things necessary to reproduce this problem. The first is the app.ini file must have permissions set such that the gitea user cannot write to the file. Second gitea must see some file difference it wants to write back to that file. To achieve the first item you can
This seems to force gitea into thinking it needs to add JWT_SECRET to that config and write it back to the file. As mentioned above I think there are two bugs here. The first is that if oauth2 is disabled gitea shouldn't do anything with secrets for oauth2. The second is that gitea should not write back to its config file. If gitea generates new config like this unexpectedly then configuration can be broken and/or mismatch what configuration management believes is in place. It is possible that this is separate issue and I'm happy to file one for that. I just saw this issue and it looks very similar (but this is happening outside of the gitea runtime and the issue I have is during runtime?) Edited to fix file permissions (they were |
Yes, it is a bug, it doesn't make sense to generate the secret if the oauth2 is disabled.
Gitea requires that the "app.ini" should be writable by itself, it's not well documented but many functions depend on this fact. |
…g in some sub-commands (#25567) Ref: * #25377 (comment) And some sub-commands like "generate" / "docs", they do not need to use the ini config
…g in some sub-commands (go-gitea#25567) Ref: * go-gitea#25377 (comment) And some sub-commands like "generate" / "docs", they do not need to use the ini config # Conflicts: # modules/setting/oauth2.go
…g in some sub-commands (#25567) (#25576) Backport #25567 Ref: * #25377 (comment) And some sub-commands like "generate" / "docs", they do not need to use the ini config
Description
Users should a have a clear and simple app.ini by default.
The text was updated successfully, but these errors were encountered: