thelounge / thelounge

💬 ‎ Modern, responsive, cross-platform, self-hosted web IRC client
https://thelounge.chat
MIT License
5.68k stars 687 forks source link

Avoid overriding the config.js file with a user.config.js file #4841

Open SirLouen opened 8 months ago

SirLouen commented 8 months ago

Feature Description

Every time I install the .deb package, it asks for a file override: overriding

Ideally, all packages with an updating system should have a user config file to avoid this.

For example, PHP package has a /conf.d/ directory, any file like user.ini won't be overridden on update but will take over default variables.

So for example, if I only want to modify the max_execution_time I can create there a user.ini file and put there the max_execution_time = 900 or whatever. This user-defined variable will override the default behavior in php.ini

What are the advantages of this?

  1. If we have an automated update system (for example, via a Debian apt repository), the software will update automatically without user intervention (specially useful for security and bug fixes)
  2. It's way easier to maintain user changes. User could opt to edit the default config.js if they don't plan to update or they don't care about dev maintained packages/updates, or they can choose to edit user.config.js only with the variables they need (the rest will remain default. User can check the official config.js to see if there are new configurations (or some are deprecated or about to be deprecated), after updates without the hassle of having to check and implement diffs during the update (which is a massive waste of time for sysadmins)
  3. This is the default expected behavior for most modern software nowadays: anything that must be modified by users should never be overridden by updates.
brunnre8 commented 8 months ago

a user config is the wrong solution. The file in /etc is the user config as far as TL is concerned.

Drop in dir with fragments could be done but frankly we update so seldom that I don't think that this is really a problem.

SirLouen commented 8 months ago

Drop in dir with fragments could be done but frankly we update so seldom that I don't think that this is really a problem.

With an unattended update system, this is a problem because the software never updates until the admin checks what's going on which ends in having to do all the manual procedure.

I think it's the most straightforward and easy implementation with a user.config.js: you get the array, and you replace the existing array with the new values. I think I could do a PR in a couple of minutes for this solution.

brunnre8 commented 8 months ago

if you actually want to work on it, merge the file in $THELOUNGE_HOME with the default config. Again, the config file there is the user config.

There's no need for user.config.js as you keep suggesting.

I'll be happy to review your patch, feel free to scratch your own itch there

SirLouen commented 8 months ago

Ok thanks, I will give it a go soon.

I find it very useful. It's true that there are not many updates, but when there are updates it's a little disturbing to do the whole switch (although probably most users just have the bare config params on the config file, they use docker, or they simply update from sources not overriding the default config file, so this is why it's not a hassle for almost anyone). But I've always liked the approach of having user-specific config files for any software. It's super clean and very easy to maintain.