예제 #1
0
파일: es_util.py 프로젝트: hysds/hysds
def get_grq_es():
    global GRQ_ES

    if GRQ_ES is None:
        aws_es = app.conf.get("GRQ_AWS_ES", False)
        es_host = app.conf["GRQ_ES_HOST"]
        es_url = app.conf["GRQ_ES_URL"]
        region = app.conf["AWS_REGION"]

        if aws_es is True:
            aws_auth = BotoAWSRequestsAuth(aws_host=es_host,
                                           aws_region=region,
                                           aws_service="es")
            GRQ_ES = ElasticsearchUtility(
                es_url=es_url,
                logger=logger,
                http_auth=aws_auth,
                connection_class=RequestsHttpConnection,
                use_ssl=True,
                verify_certs=False,
                ssl_show_warn=False,
            )
        else:
            GRQ_ES = ElasticsearchUtility(es_url, logger)
    return GRQ_ES
예제 #2
0
def get_mozart_es(es_url, logger=None):
    global MOZART_ES
    if MOZART_ES is None:
        MOZART_ES = ElasticsearchUtility(es_url, logger)
    return MOZART_ES
예제 #3
0
파일: es_util.py 프로젝트: sodonnell/hysds
def get_mozart_es():
    global MOZART_ES
    if MOZART_ES is None:
        MOZART_ES = ElasticsearchUtility(app.conf.JOBS_ES_URL, logger)
    return MOZART_ES
예제 #4
0
# TODO: may remove this (and any code related to User models and authentication) once SSO is integrated
# set database config
dbdir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'data'))
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' + os.path.join(dbdir, 'app.db')
db = SQLAlchemy(app)

# set user auth config
lm = LoginManager()
lm.init_app(app)
lm.login_view = 'views/main.login'

# handle global errors
app.register_error_handler(404, resource_not_found)

# Mozart's connection to Elasticsearch
mozart_es = ElasticsearchUtility(app.config['ES_URL'])

# add jenkins connection
if app.config.get('JENKINS_ENABLED', False):
    jenkins_wrapper = Jenkins(app.config['JENKINS_HOST'], username=app.config['JENKINS_USER'],
                              password=app.config['JENKINS_API_KEY'])
    from mozart.services.ci import services as ci_services
    app.register_blueprint(ci_services)
else:
    jenkins_wrapper = None

# views blueprints
from mozart.views.main import mod as views_module
app.register_blueprint(views_module)

# services blueprints
예제 #5
0
파일: __init__.py 프로젝트: hysds/tosca
# set database config
dbdir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'data'))
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' + os.path.join(
    dbdir, 'app.db')
db = SQLAlchemy(app)

# debug toolbar
debug_toolbar = DebugToolbarExtension(app)

# set user auth config
lm = LoginManager()
lm.init_app(app)
lm.login_view = 'views/main.login'

# initializing connection to GRQ's Elasticsearch
grq_es = ElasticsearchUtility(app.config['ES_URL'], app.logger)

# initializing connection to Mozart's Elasticsearch
mozart_es = ElasticsearchUtility(app.config['MOZART_ES_URL'], app.logger)

# views blueprints
from tosca.views.main import mod as viewsModule
app.register_blueprint(viewsModule)

from tosca.views.js import mod as jsModule
app.register_blueprint(jsModule)

# services blueprints
from tosca.services.query import mod as queryModule
app.register_blueprint(queryModule)