-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Fix handling of additional config files #49926
base: master
Are you sure you want to change the base?
Conversation
/backport to stable30 |
/backport to stable29 |
/backport to stable28 |
Signed-off-by: provokateurin <[email protected]>
…ritten by additional config files Signed-off-by: provokateurin <[email protected]>
9392aab
to
0030523
Compare
This breaks my development setup, where after installing I put in some config files to change e.g. apps_paths, trusted domains, etc. with some further values. In my set up, I put the files in place, enable maintenance mode and disable it again, to copy the nested arrays all into the main config.php and then delete the temporary config files. I'm pretty sure that there are cases in bigger installations where extra files are also used, and having a variable there that is also in the main file could be quite common:
Would it instead make more sense to yield a setupcheck instead of breaking any set/delete? |
I don't understand how this breaks your dev setup. Why can't you just have the options you need in the additional config file without copying something? I'm not sure I understand how your setup works.
I see, this is indeed a valid use-case that breaks this way. I wonder if it is really the best way to override a value temporarily. It should either be managed outside the config files or we make it possible to have a stable defined order of config files so you can have a 99-overrides.config.php.
What's the point of this, then the value should just go into the additional config file. It is overwritten by the additional config file anyway, so it's not like the value is ever used in this case. This should not work at all.
As I said set/delete are already broken, if you have an additional config file that sets the same keys. The exceptions just prevent that someone uses it and gets confused why the new value is never used. |
Actually this doesn't work either, you can only override the value in an additional config file but not in the main config file. |
And the alternative to this would be to have a proper order, so you can actually override values safely. |
I agree that removing stuff from config.php automagically if present in additional config file is weird and unexpected to users. Proper fix could be:
|
This is literally what this PR does. The only unexpected thing might be the removal of duplicate keys from the main config file (if they are already present right now) and we could fix that in some way as I already proposed some solutions for that. |
Thank you very much for picking this up 🙏! The current behavior has been bothering me for a while, especially because it can lead to so many weird states. For example, with the email settings: if the SMTP parameters are defined in A nice follow-up could be to maintain a list of immutable variables and signal back to the frontend when something is not configurable. Honestly, I’ve always been hesitant to touch this part of the code because it feels like a rabbit hole 🙈. That said, I think this is a great improvement and hope to see it land soon! I’m sorry to bring up another potential issue: the updater currently only reads The reason for the revert was that some people followed our example in https://docs.nextcloud.com/server/latest/admin_manual/apps_management.html#using-custom-app-directories and configured additional app directories using To achieve this, we need to develop a plan or provide documentation on how to update such configurations. Thanks again for your efforts! |
Summary
With this change all config keys in the main config file will be removed if they are also specified in an additional config file, but that is correct as the value from the additional config file was overwriting the value anyway.
These problems exist at least for https://github.com/nextcloud/helm and https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/services/web-apps/nextcloud.nix, and I'm sure other systems experience the same problems.
Another thing to improve would be to throw an error if two config files specify the same key. They are not merged recursively and the order of how the config files are applied might not be stable, so could definitely lead to unexpected results.
Checklist