Using the Flask-Env library, allow overwriting configuration files with environment variables. This is done by passing ENV as an argument to run.py and putting DIGMILL_ before a particular configuration option.
For example: env DIGMILL_MONGO_HOST=mongo python run.py config.cfg ENV will use the configuration specified in config.cfg but overwrite the MONGO_HOST option.
I think this is the ideal solution. It provides a lot of flexibility without making major changes, since:
deployment scripts don't have to be changed to use the environment instead of a .cfg files
the application can be deployed with environment variable configuration if it needs to be (for example, any PaaS that requires 12 factor apps)
the default configuration is shared in both cases.
Coverage increased (+0.03%) to 86.236% when pulling 6939ed532571dfd16d2a3a38e9aa2537c49ac26f on configure-with-env into 7786138f2c5d59dc9293908c9ab5ffb21f15cf24 on master.
Using the
Flask-Env
library, allow overwriting configuration files with environment variables. This is done by passingENV
as an argument torun.py
and puttingDIGMILL_
before a particular configuration option.For example:
env DIGMILL_MONGO_HOST=mongo python run.py config.cfg ENV
will use the configuration specified inconfig.cfg
but overwrite theMONGO_HOST
option.I think this is the ideal solution. It provides a lot of flexibility without making major changes, since:
.cfg
files