ConfigurationΒΆ

In addition to standard Flask configuration Ampho proposes simple file based configuration mechanism.

By default Ampho expects a folder existing at location defined by AMPHO_CONFIG_DIR configuration parameter. This is the folder where configuration files should be placed to let Ampho load them at initialization time. By default value of the AMPHO_CONFIG_DIR parameter contains path to the directory config located next to the root path.

For example:

/hello-world
    /app
    /config
        default.json
        development.py
        production.py
        home_user@dev.test.com.json
        prod_user@test.com.json

When Ampho is being initialized, it tries to load configuration files in the following order:

  1. default.json
  2. {environment}.json
  3. {username}@{hostname}.json

where parameters from each next file will be merged with a previous one. The default.json file is being loaded always. The {environment}.json is loaded only if {environment} corresponds to current ${FLASK_ENV} environment variable value. And the {username}@{hostname}.json will be loaded only if {username} and {hostname} are correspond to the ${USER} and ${HOSTNAME} environment variables.

Using this approach, you can store all the application configuration at one place, while Ampho will choose and merge appropriate configuration set automatically depending on environment where application runs. You can use json files as well as py ones.

If you want completely disable this Ampho feature, you can do this by setting AMPHO_LOG to 0.