Skip to content

Simplified config take 2#14

Merged
akbargumbira merged 3 commits intoid-python:developfrom
iromli:appconfig
Jul 3, 2014
Merged

Simplified config take 2#14
akbargumbira merged 3 commits intoid-python:developfrom
iromli:appconfig

Conversation

@iromli
Copy link
Copy Markdown
Member

@iromli iromli commented Jul 2, 2014

This changeset introduces flask-appconfig integration to manage app configuration loading. By using this extension, we have more possibilities to configure the app:

  1. Use default config users/default_config.py.

  2. Use default config and override necessary values using user-defined config file.

    Default config:

    # users/default_config.py
    MAIL_SUPPRESS_SEND=False
    DEBUG = False

    Custom config:

    # /path/to/custom_config.py
    MAIL_SUPPRESS_SEND=True
    DEBUG = True

    Example usage:

    USERS_CONFIG=/path/to/custom_config.py python runserver.py
  3. Use default config and override necessary values using environment variable.

    Default config:

    # users/default_config.py
    MAIL_SUPPRESS_SEND=False
    DEBUG = False

    By using enviroment variable, we could override specific item, for example:

    USERS_MAIL_SUPPRESS_SEND=True USERS_DEBUG=True ./runtests.sh

    Note, to use the environment variable properly, the USERS_ prefix must exist.

Now we have more controls on how to configure app in various usecases, e.g. Travis CI integration.

@akbargumbira
Copy link
Copy Markdown
Member

Thanks @iromli, this is very nice..

akbargumbira added a commit that referenced this pull request Jul 3, 2014
@akbargumbira akbargumbira merged commit a0594a3 into id-python:develop Jul 3, 2014
@iromli iromli deleted the appconfig branch July 3, 2014 10:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants