Skip to content

Refactor: Get all configuration variables from just one place. #70

@tsrivishnu

Description

@tsrivishnu

Right now, app/__init.py__ reads from config.py which defines few constant variables and also loads few from database.yml and application.yml. Would be nice to just have one place (or at least one file for all variables that are secret or not constant) to look at for all the application variables.

After some reading, I suggest, we use an approach similar to the one discussed in the Flask guides: http://exploreflask.com/en/latest/configuration.html#configuring-based-on-environment-variables

  • We will make environment specific configuration files under config/ directory.

    config/
      __init__.py # Empty, just here to tell Python that it's a package.
      default.py
      production.py
      development.py
  • config/default.py will be checked in into the source code. So define secrets as empty strings.

  • we will load the configuration in app/__init__.py depending on the environment the app is running in or just load the default.

  • config/production.py and config/development.py will not be checked in into the source control.

Reference:

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions