def autoconfigure(filename=None, config=None, force=False):
    """Run ``file_config`` and ``env_config`` if the module has not
    been initialized.
    """
    if not force and is_configured():
        logger.debug('System already configured, skipping autoconfiguration')
        return

    # start with the current configuration
    newconfig = bigchaindb.config

    # update configuration from file
    try:
        newconfig = update(newconfig, file_config(filename=filename))
    except FileNotFoundError as e:
        if filename:
            raise
        else:
            logger.info('Cannot find config file `%s`.' % e.filename)

    # override configuration with env variables
    newconfig = env_config(newconfig)
    if config:
        newconfig = update(newconfig, config)
    set_config(newconfig)  # sets bigchaindb.config
Run ``file_config`` and ``env_config`` if the module has not
been initialized.
bigchaindb/config_utils.py