getmango / Mango

Mango is a self-hosted manga server and web reader
https://getmango.app
MIT License
1.7k stars 122 forks source link

Allow config defaults to be sourced from ENV #314

Closed crainte closed 2 years ago

crainte commented 2 years ago

I'm not sure if you're interested in this, but it made running Mango much easier on my local install.

This allows the default config to source values from ENV variables if they are set. With this change we don't have to modify the docker CMD or edit the config.yml and then relaunch.

hkalexling commented 2 years ago

Hey thanks for the PR! I like the idea, and I refactored it with macro to enforce DRY. Note that now the environment variable names are just upper-case version of the Crystal variable names, so you might want to change some of the keys if you are actively using the old implementation.