-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Gitea should offer a configcheck command #2762
Comments
In this case, there's nothing wrong with the config file itself, so a verification wouldn't help. The issue is that Gitea can't write to the config-file, hence it fails. With that said, having a |
A mandatory config key missing is an error in the config file. The fact that Gitea might be able to fix that automatically doesn't mean its not an error. Otherwise, Gitea would continue to run without the key being set. |
Gitea needs to generate and write this token on each start-up, having the config file in read-only is the error. |
That makes even less sense. Why would it need to be written to the config file, if it is recomputed at every start? And why do you insist that Gitea must be able to write the config file? |
It needs to be written to a file (the config was available so it ended up there) because As for Gitea needing to write the config, that's because the initial setup in only available in the WebUI (therefore needs to be managed by Gitea itself), and that one needs to write the config to disk afterwards Edit: It's not perfect, but it's what we have. PRs welcome |
Another reason except installation is because Gitea in fact provides serval sub command, |
@lunny or let's move such data to database |
@lafriks don't want |
Storing this secret in the config file is acceptable, but there should be documentation on what it is used for, and how to create one yourself, if you prefer to keep the config file readonly and managed outside of Gitea. From reading the source, it appears that the only requirement for a value is a non-empty string; however, a sensibly complex random string is preferreable. In the FreeBSD port, a random number is generated with openssl, producing a similar value to the code in modules/setting/setting.go. To get back to the original feature request: while it's nice that Gitea can be set up through a web browser, there a re scenarios in which it is preferrable for the config file to be read-only to the Gitea user, and the config file contents being managed by some configuration management tool. It would be great if Gitea would support this scenario with appropriate error messages. The standard Alternatively, the output form |
@lunny For A quick google suggest for example: https://gist.github.com/teknoraver/5ffacb8757330715bcbcc90e6d46ac74 |
@stblassitude thanks, I will check that. |
@lunny @stblassitude gitea does that already if gitea is set to listen on socket using fcgi |
Writing the configuration file automatically, which is meant to be customized by the user, is very bad practise which I'd consider being a bug. In fact, like @stblassitude said, it's very complex to automate configuration deployment in an idempotent manner. If there was a hard requirement to write such information into a file, it might get written into another file, but not in the configuration file, which is meant for the user to customize the runtime of gitea. Furthermore +1 on this feature request. It would be very nice to verify the configuration before restarting a service automatically on a configuration file update. |
because: go-gitea/gitea#2762
because: go-gitea/gitea#2762
Using the FreeBSD port for Gitea on FreeBSD 11.1.
Description
After upgrading to Gitea 1.2, Gitea won't start if the config file cannot be written by the user Gitea is running under:
This is due to the security/INTERNAL_TOKEN option not being set, and Gitea being unable to add it to the config itself.
Start scripts should be able to verify the configuration and print appropriate error messages, before trying to start Gitea as a daemon.
The text was updated successfully, but these errors were encountered: