New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for environment variables as config #61
Conversation
Any update on this? |
Hi Andy, Te patch needs to be updated as I think it could be something like: db_driver = opts.db_driver or os.getenv('MLSTATS_DB_DRIVER', 'mysql') What do you think? |
* upstream/master: Add mailing_list_url column to PSQL schema Use argparse to replace the old getopt analyzer: Check if year is higher than 1900. Fixes 63 Prepare regex to clean up the Reply-To field Refactor analyzer to split mbox from message parser test: Assume DB driver as sqlite is none is specified Add offset option to start at an arbitrary message. Fixes #62 backends: Add Webdirectory backend. Fix #35 Move fetch_remote_resource to pymlstats/htmlparser Decouple the archive retrieval process from the application
@gpoo I updated this PR. Anything missing that avoids a merge? |
I think both approaches give the same result. The right part of the Anyhow, I agree that the default is a cleaner approach :-) |
I forgot to say, it looks ok to me. |
That is great and i learned a new thing (with the @gpoo Are you fine with it when i merge it? |
Totally. |
In terms of the 12 factor apps configuration settings should be applied as env vars as well.
See http://12factor.net/config
This pull request enables the configuration for mlstats via env vars.
All other configuration types (incl. default values) are still supported.
This env vars are supported:
MLSTATS_DB_DRIVER
MLSTATS_DB_USERNAME
MLSTATS_DB_PASSWORD
MLSTATS_DB_HOSTNAME
MLSTATS_DB_NAME
MLSTATS_WEB_USERNAME
MLSTATS_WEB_PASSWORD
MLSTATS_COMPRESSED_DIR
MLSTATS_REPORT_FILENAME
MLSTATS_REPORT
MLSTATS_QUIET
MLSTATS_FORCE
The names of the env vars follows the schema
APPNAME_SECTION_CONFIG
.With this PR the usage of mlstats for Docker or "cloud" envs is much easier.
See 12 Fractured Apps for further read.
See chaoss/grimoirelab-sortinghat#45 for the sortinghat edition.