예제 #1
0
def create_web_app() -> Flask:
    """Initialize and configure the accounts application."""
    app = Flask('registry')
    app.config.from_pyfile('config.py')

    # app.register_blueprint(ui.blueprint)

    datastore.init_app(app)
    SessionStore.init_app(app)

    Base(app)  # Gives us access to the base UI templates and resources.
    auth.Auth(app)  # Handless sessions and authn/z.
    oauth2.init_app(app)
    app.register_blueprint(blueprint)

    middleware = [AuthMiddleware]
    if app.config['VAULT_ENABLED']:
        middleware.insert(0, vault.middleware.VaultMiddleware)
    wrap(app, middleware)
    if app.config['VAULT_ENABLED']:
        app.middlewares['VaultMiddleware'].update_secrets({})

    app.jinja_env.filters['scope_label'] = filters.scope_label

    if app.config['CREATE_DB']:
        with app.app_context():
            datastore.create_all()

    register_error_handlers(app)
    return app
예제 #2
0
def create_web_app() -> Flask:
    """Initialize and configure the accounts application."""
    app = Flask('registry')
    app.config.from_pyfile('config.py')

    # app.register_blueprint(ui.blueprint)

    datastore.init_app(app)
    sessions.init_app(app)

    Base(app)  # Gives us access to the base UI templates and resources.
    auth.Auth(app)  # Handless sessions and authn/z.
    oauth2.init_app(app)
    app.register_blueprint(blueprint)
    wrap(app, [auth.middleware.AuthMiddleware])

    app.jinja_env.filters['scope_label'] = filters.scope_label

    datastore.create_all()
    return app
예제 #3
0
"""Create all tables in the registry database."""

from registry.factory import create_web_app
from registry.services import datastore

app = create_web_app()
datastore.init_app(app)
with app.app_context():
    datastore.create_all()