def init_app(app, env=None):
    """
    Configure an app depending on the environment. Loads settings from a file
    named ``settings.py`` in the instance folder, followed by additional
    settings from one of ``development.py``, ``production.py`` or
    ``testing.py``. Typical usage::

        from flask import Flask
        import coaster.app

        app = Flask(__name__, instance_relative_config=True)
        coaster.app.init_app(app)  # Guess environment automatically

    :func:`init_app` also configures logging by calling
    :func:`coaster.logger.init_app`.

    :param app: App to be configured
    :param env: Environment to configure for (``'development'``,
        ``'production'`` or ``'testing'``). If not specified, the ``FLASK_ENV``
        environment variable is consulted. Defaults to ``'development'``.
    """
    # Make current_auth available to app templates
    app.jinja_env.globals['current_auth'] = current_auth
    # Make the current view available to app templates
    app.jinja_env.globals['current_view'] = current_view
    # Disable Flask-SQLAlchemy events.
    # Apps that want it can turn it back on in their config
    app.config.setdefault('SQLALCHEMY_TRACK_MODIFICATIONS', False)
    # Load config from the app's settings.py
    load_config_from_file(app, 'settings.py')
    # Load additional settings from the app's environment-specific config file
    if not env:
        env = environ.get('FLASK_ENV', 'DEVELOPMENT')  # Uppercase for compatibility with Flask-Environments
    additional = _additional_config.get(env.lower())  # Lowercase because that's how we define it
    if additional:
        load_config_from_file(app, additional)

    logger.init_app(app)
Configure an app depending on the environment. Loads settings from a file
    named ``settings.py`` in the instance folder, followed by additional
    settings from one of ``development.py``, ``production.py`` or
    ``testing.py``. Typical usage::

        from flask import Flask
        import coaster.app

        app = Flask(__name__, instance_relative_config=True)
        coaster.app.init_app(app)  # Guess environment automatically

    :func:`init_app` also configures logging by calling
    :func:`coaster.logger.init_app`.

    :param app: App to be configured
    :param env: Environment to configure for (``'development'``,
        ``'production'`` or ``'testing'``). If not specified, the ``FLASK_ENV``
        environment variable is consulted. Defaults to ``'development'``.