krateng / maloja

Self-hosted music scrobble database to create personal listening statistics and charts
https://maloja.krateng.ch
GNU General Public License v3.0
1.12k stars 63 forks source link

Don't overwrite config file #103

Open Sohalt opened 2 years ago

Sohalt commented 2 years ago

Maloja tries to write it's config in /etc/maloja/settings.ini, which is pretty unexpected behavior. It would be good if maloja would not write to config files. If it needs to store some state, it should instead use the state directory.

On NixOS for example the config file lives in a read-only file system, which makes Maloja crash. It also leads to unexpected behavior when versioning the config file with git or another version control system.

krateng commented 2 years ago

This is kind of necessary as the configuration can be changed from other sources (web interface). I'll see if I can implement a read-only mode for this, but it could take a while as I'm still in the middle of the rework. As a workaround, you can put the configuration directory somewhere else with MALOJA_DIRECTORY_CONFIG.

krateng commented 2 years ago

How does NixOS handle initial creation of the config file? Can the application create the file initially, but then never write to it again?

Sohalt commented 2 years ago

The initial (and subsequent) creation is done by the package manager/operating system. The application can't write to /etc at any time.

13.04.2022 05:03:27 krateng @.***>:

How does NixOS handle initial creation of the config file? Can the application create the file initially, but then never write to it again?

— Reply to this email directly, view it on GitHub[https://github.com/krateng/maloja/issues/103#issuecomment-1097502308], or unsubscribe[https://github.com/notifications/unsubscribe-auth/AAQOVZ3POAEMXIP6ZFYMM2DVEY2PLANCNFSM5RUPGIMQ]. You are receiving this because you authored the thread.[Verfolgungsbild][https://github.com/notifications/beacon/AAQOVZ5ILRJMEXRI3NCSAY3VEY2PLA5CNFSM5RUPGIM2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOIFVI4ZA.gif]

gBasil commented 1 year ago

@krateng Tangentially related, but what would be the current best way to declaratively configure Maloja? I'm working on getting Maloja to run on NixOS, and I've run into the same issue. A few potential solutions for getting this done on the Nix side: