Prepare and return alembic config
    These configurations used to live in alembic config initialiser, but that
    just tight coupling. Ideally we should move that to userspace and find a
    way to pass these into alembic commands.

    @todo: think about it

def get_config():
    """
    Prepare and return alembic config
    These configurations used to live in alembic config initialiser, but that
    just tight coupling. Ideally we should move that to userspace and find a
    way to pass these into alembic commands.

    @todo: think about it
    """
    from boiler.migrations.config import MigrationsConfig

    # used for errors
    map = dict(
        path='MIGRATIONS_PATH',
        db_url='SQLALCHEMY_DATABASE_URI',
        metadata='SQLAlchemy metadata'
    )

    app = bootstrap.get_app()
    params = dict()
    params['path'] = app.config.get(map['path'], 'migrations')
    params['db_url'] = app.config.get(map['db_url'])
    params['metadata'] = db.metadata

    for param, value in params.items():
        if not value:
            msg = 'Configuration error: [{}] is undefined'
            raise Exception(msg.format(map[param]))

    config = MigrationsConfig(**params)
    return config