Exemple #1
0
def app():
    """
    Build an app with an authenticated dummy api
    """

    # Use unique auth instance
    config = {
        'DEBUG': True,
    }
    app = create_app('test', extensions=[auth], config=config)

    @app.route('/')
    def index():
        return app.response_class('OK')

    @app.route('/test-login')
    @auth.auth.require_login
    def logged_in():
        data = {
            'auth': True,
            'user': current_user.get_id(),
            'scopes': current_user.permissions,
        }
        return jsonify(data)

    @app.route('/test-scopes')
    @auth.auth.require_scopes([
        ['project/test/A', 'project/test/B'],
        ['project/test-admin/*'],
    ])
    def scopes():
        return app.response_class('Your scopes are ok.')

    # Add fake swagger url, used by redirect
    app.api.swagger_url = '/'

    return app
Exemple #2
0
DEBUG = os.environ.get('DEBUG') == 'true' or __name__ == '__main__'
HERE = os.path.dirname(os.path.abspath(__file__))
APP_SETTINGS = os.path.abspath(os.path.join(HERE, '..', 'settings.py'))


def init_app(app):

    # Register extra commands
    app.cli.add_command(run_workflow)
    app.cli.add_command(run_workflow_local)

    # Register swagger api
    return app.api.register(
        os.path.join(os.path.dirname(__file__), 'api.yml'))


if not os.environ.get('APP_SETTINGS') and \
       os.path.isfile(APP_SETTINGS):
    os.environ['APP_SETTINGS'] = APP_SETTINGS


app = create_app(
    "shipit_dashboard",
    extensions=[init_app, db, auth],
    debug=DEBUG,
    debug_src=HERE,
)

if __name__ == "__main__":
    app.run(**app.run_options())
Exemple #3
0

def init_app(app):
    return app.api.register(
        os.path.join(os.path.dirname(__file__), 'api.yml'))


if DEBUG and not os.environ.get('DATABASE_URL'):
    os.environ['DATABASE_URL'] = 'sqlite:///%s' % (
        os.path.abspath(os.path.join(HERE, '..', 'app.db')))

if not os.environ.get('APP_SETTINGS') and \
       os.path.isfile(APP_SETTINGS):
    os.environ['APP_SETTINGS'] = APP_SETTINGS


app = releng_common.create_app(
    "shipit_signoff",
    extensions=[
        init_app,
        releng_common.auth,
        releng_common.db,
    ],
    debug=DEBUG,
    debug_src=HERE,
)


if __name__ == "__main__":
    app.run(**app.run_options())
Exemple #4
0
HERE = os.path.dirname(os.path.abspath(__file__))
APP_SETTINGS = os.path.abspath(os.path.join(HERE, '..', 'settings.py'))


def init_app(app):
    app.api.register(os.path.join(os.path.dirname(__file__), 'api.yml'))


if DEBUG and not os.environ.get('DATABASE_URL'):
    os.environ['DATABASE_URL'] = 'sqlite:///%s' % (os.path.abspath(
        os.path.join(HERE, '..', 'app.db')))

if not os.environ.get('APP_SETTINGS') and \
       os.path.isfile(APP_SETTINGS):
    os.environ['APP_SETTINGS'] = APP_SETTINGS

app = releng_common.create_app(
    "releng_treestatus",
    extensions=[
        init_app,
        releng_common.auth,
        releng_common.db,
        releng_common.cache,
    ],
    debug=DEBUG,
    debug_src=HERE,
)

if __name__ == "__main__":
    app.run(**app.run_options())
Exemple #5
0
import releng_common
import releng_common.db

DEBUG = bool(os.environ.get('DEBUG', __name__ == '__main__'))
HERE = os.path.dirname(os.path.abspath(__file__))
APP_SETTINGS = os.path.abspath(os.path.join(HERE, '..', 'settings.py'))


def init_app(app):
    return app.api.register(os.path.join(os.path.dirname(__file__), 'api.yml'))


if DEBUG and not os.environ.get('DATABASE_URL'):
    os.environ['DATABASE_URL'] = 'sqlite:///%s' % (os.path.abspath(
        os.path.join(HERE, '..', 'app.db')))

if not os.environ.get('APP_SETTINGS') and \
       os.path.isfile(APP_SETTINGS):
    os.environ['APP_SETTINGS'] = APP_SETTINGS

app = releng_common.create_app(
    "shipit_workflow",
    extensions=[init_app, releng_common.db],
    debug=DEBUG,
    debug_src=HERE,
)

if __name__ == "__main__":
    app.run(**app.run_options())
Exemple #6
0
DEBUG = bool(os.environ.get('DEBUG', __name__ == '__main__'))
HERE = os.path.dirname(os.path.abspath(__file__))
APP_SETTINGS = os.path.abspath(os.path.join(HERE, '..', 'settings.py'))


def init_app(app):
    return app.api.register(
        os.path.join(os.path.dirname(__file__), 'api.yml'))


if DEBUG and not os.environ.get('DATABASE_URL'):
    os.environ['DATABASE_URL'] = 'sqlite:///%s' % (
        os.path.abspath(os.path.join(HERE, '..', 'app.db')))

if not os.environ.get('APP_SETTINGS') and \
       os.path.isfile(APP_SETTINGS):
    os.environ['APP_SETTINGS'] = APP_SETTINGS


app = releng_common.create_app(
    "releng_archiver",
    extensions=[init_app, releng_common.db],
    debug=DEBUG,
    debug_src=HERE,
)


if __name__ == "__main__":
    app.run(**app.run_options())
Exemple #7
0
from shipit_dashboard.workflow import run_workflow, run_workflow_local

DEBUG = os.environ.get('DEBUG') == 'true' or __name__ == '__main__'
HERE = os.path.dirname(os.path.abspath(__file__))
APP_SETTINGS = os.path.abspath(os.path.join(HERE, '..', 'settings.py'))


def init_app(app):

    # Register extra commands
    app.cli.add_command(run_workflow)
    app.cli.add_command(run_workflow_local)

    # Register swagger api
    return app.api.register(os.path.join(os.path.dirname(__file__), 'api.yml'))


if not os.environ.get('APP_SETTINGS') and \
       os.path.isfile(APP_SETTINGS):
    os.environ['APP_SETTINGS'] = APP_SETTINGS

app = create_app(
    "shipit_dashboard",
    extensions=[init_app, db, auth],
    debug=DEBUG,
    debug_src=HERE,
)

if __name__ == "__main__":
    app.run(**app.run_options())
Exemple #8
0

def init_app(app):
    app.api.register(os.path.join(os.path.dirname(__file__), 'api.yml'))


if DEBUG and not os.environ.get('DATABASE_URL'):
    os.environ['DATABASE_URL'] = 'sqlite:///%s' % (
        os.path.abspath(os.path.join(HERE, '..', 'app.db')))

if not os.environ.get('APP_SETTINGS') and \
       os.path.isfile(APP_SETTINGS):
    os.environ['APP_SETTINGS'] = APP_SETTINGS


app = releng_common.create_app(
    "releng_treestatus",
    extensions=[
        init_app,
        releng_common.auth,
        releng_common.db,
        releng_common.cache,
    ],
    debug=DEBUG,
    debug_src=HERE,
)


if __name__ == "__main__":
    app.run(**app.run_options())
Exemple #9
0
import os

import releng_common
import releng_common.db
import releng_common.auth


DEBUG = bool(os.environ.get("DEBUG", __name__ == "__main__"))
HERE = os.path.dirname(os.path.abspath(__file__))
APP_SETTINGS = os.path.abspath(os.path.join(HERE, "..", "settings.py"))


def init_app(app):
    return app.api.register(os.path.join(os.path.dirname(__file__), "api.yml"))


if DEBUG and not os.environ.get("DATABASE_URL"):
    os.environ["DATABASE_URL"] = "sqlite:///%s" % (os.path.abspath(os.path.join(HERE, "..", "app.db")))

if not os.environ.get("APP_SETTINGS") and os.path.isfile(APP_SETTINGS):
    os.environ["APP_SETTINGS"] = APP_SETTINGS


app = releng_common.create_app(
    "shipit_pipeline", extensions=[init_app, releng_common.auth, releng_common.db], debug=DEBUG, debug_src=HERE
)


if __name__ == "__main__":
    app.run(**app.run_options())