Beispiel #1
0
def init_apis(app):
    _init(app)
    _init_user_model()
    _init_tables(app)
    uri_router.register_api_module()
    api_auth.register_login_module()
    _init_beaker_compat()
Beispiel #2
0
def init_by_server(app):
    """Initialize module"""
    if app.sirepo_use_reloader and os.environ.get(
            'WERKZEUG_RUN_MAIN') != 'true':
        # avoid first call to init() when using reloader
        return
    global _job_class

    if _job_class:
        return
    if cfg.job_class is None:
        from sirepo import server
        d = _JOB_CLASS_DEFAULT
        if server.cfg.job_queue:
            # Handle deprecated case
            d = server.cfg.job_queue.lower()
        cfg.job_class = d
    m = importlib.import_module(
        pkinspect.module_name_join((
            __name__,
            cfg.job_class,
        )), )
    _job_class = m.init_class(app)
    from sirepo import runner_api
    from sirepo import uri_router

    uri_router.register_api_module(runner_api)
Beispiel #3
0
def init_apis(app):
    _init(app)
    _init_user_model()
    _init_tables(app)
    uri_router.register_api_module()
    api_auth.register_login_module()
    _init_beaker_compat()
Beispiel #4
0
def init_by_server(app):
    """Initialize module"""
    init()

    from sirepo import job_api
    from sirepo import uri_router

    uri_router.register_api_module(job_api)
Beispiel #5
0
def _init():
    if pkconfig.channel_in_internal_test():
        from sirepo import uri_router
        uri_router.register_api_module()
    else:
        global utc_now_as_float, utc_now
        utc_now_as_float = time.time
        utc_now = datetime.datetime.utcnow
Beispiel #6
0
def init_apis(app):
    uri_router.register_api_module()
    global cfg
    cfg = pkconfig.init(
        username=(None, str, 'Sirepo status user id'),
        password=(None, str, 'Basic Auth password'),
    )
    if not cfg.username or not cfg.password:
        raise RuntimeError('Missing Sirepo status config')
    app.config['BASIC_AUTH_USERNAME'] = cfg.username
    app.config['BASIC_AUTH_PASSWORD'] = cfg.password
    global _basic_auth
    _basic_auth = BasicAuth(app)
Beispiel #7
0
def init_apis(app):
    global cfg
    cfg = pkconfig.init(
        mail_server=(None, str, 'Mail server'),
        mail_username=(None, str, 'Mail user name'),
        mail_password=(None, str, 'Mail password'),
        mail_support_email=(None, str, 'Support email address'),
        mail_recipient_email=(None, str, 'Email to receive registration messages'),
    )
    assert cfg.mail_server and cfg.mail_username and cfg.mail_password \
        and cfg.mail_support_email and cfg.mail_recipient_email, \
        'Missing mail config'
    app.config.update(
        MAIL_USE_TLS=True,
        MAIL_PORT=587,
        MAIL_SERVER=cfg.mail_server,
        MAIL_USERNAME=cfg.mail_username,
        MAIL_PASSWORD=cfg.mail_password,
    )
    global _mail
    _mail = flask_mail.Mail(app)
    uri_router.register_api_module()
Beispiel #8
0
def init_apis(app):
    uri_router.register_api_module()
Beispiel #9
0
def init_apis(app):
    assert cfg.auth_secret, \
        'sirepo_bluesky_auth_secret is not configured'
    uri_router.register_api_module()
Beispiel #10
0
def init_apis(app):
    assert cfg.auth_secret, \
        'sirepo_bluesky_auth_secret is not configured'
    uri_router.register_api_module()