zorchenhimer / MoviePolls

Voting to decide on a movie to watch with MovieNight
https://discord.gg/F2VSgjJ
16 stars 6 forks source link

Decent handling of the configuration #121

Open CptPie opened 2 years ago

CptPie commented 2 years ago

While browsing GitHub I came across this library https://github.com/JeremyLoy/config

It provides really simple env variable and config file configuration.

This might be a better way to handle the config stuff (instead of saving it into the DB ...)

I know you don't want unnecessary additional dependencies but the config saved in the DB always bothered me and I think this could improve the situation by a huge margin.

What's your take @zorchenhimer ?

CptPie commented 2 years ago

An other option https://github.com/olebedev/config

zorchenhimer commented 2 years ago

Leaving aside the specific implementation of a configuration file for now, what would it contain?

I figure it would have values that would typically require a server restart to change. Things like the listen address/port. I would like to keep other settings that wouldn't require a restart in the database.

CptPie commented 2 years ago

I mean in the end its a decision you'll make - in my opinion a database should not contain configuration aspects of the application. This is based on 2 core thoughts of mine: a) a database should not necessarily contain data that can change often (after inserted) and b) coming from a sysadmin standpoint having a configuration file for all the settings currently managed in the admin view would make rapid (re-)deployment easier (the config file could be injected into the docker container for example etc.). If i understood those libs correctly (after a really quick look at them) it should be totally feasable to still have the admin config view and instead of updating values of the db instead updating them in the config file.