def main(global_config, **local_config): """ This function returns a Pyramid WSGI application. """ settings = global_config settings.update(local_config) # TODO - these need to be set for dummy app # settings['snovault.jsonld.namespaces'] = json_asset('snovault:schemas/namespaces.json') # settings['snovault.jsonld.terms_namespace'] = 'https://www.encodeproject.org/terms/' settings['snovault.jsonld.terms_prefix'] = 'snovault' settings['snovault.elasticsearch.index'] = 'snovault' config = Configurator(settings=settings) from snovault.elasticsearch import APP_FACTORY config.registry[APP_FACTORY] = main # used by mp_indexer config.include(app_version) config.include( 'pyramid_multiauth') # must be before calling set_authorization_policy from pyramid_localroles import LocalRolesAuthorizationPolicy # Override default authz policy set by pyramid_multiauth config.set_authorization_policy(LocalRolesAuthorizationPolicy()) config.include(session) config.include(configure_dbsession) config.include('snovault') config.commit() # commit so search can override listing # Render an HTML page to browsers and a JSON document for API clients config.include('snowflakes.renderers') # these two should be application specific config.include('.authentication') config.include('snowflakes.root') if 'elasticsearch.server' in config.registry.settings: config.include('snovault.elasticsearch') config.include('snowflakes.search_views') config.include(static_resources) config.include(changelogs) # TODO This is optional AWS only - possibly move to a plug-in aws_ip_ranges = json_from_path(settings.get('aws_ip_ranges_path'), {'prefixes': []}) config.registry['aws_ipset'] = netaddr.IPSet( record['ip_prefix'] for record in aws_ip_ranges['prefixes'] if record['service'] == 'AMAZON') if asbool(settings.get('testing', False)): config.include('.tests.testing_views') # Load upgrades last so that all views (including testing views) are # registered. # TODO we would need a generic upgrade audit PACKAGE (__init__) # config.include('.audit) # config.include('.upgrade') app = config.make_wsgi_app() return app
def main(global_config, **local_config): """ This function returns a Pyramid WSGI application. """ settings = global_config settings.update(local_config) settings['snovault.jsonld.namespaces'] = json_asset('snowflakes:schemas/namespaces.json') settings['snovault.jsonld.terms_namespace'] = 'https://www.encodeproject.org/terms/' settings['snovault.jsonld.terms_prefix'] = 'snowflake' settings['snovault.elasticsearch.index'] = 'snovault' hostname_command = settings.get('hostname_command', '').strip() if hostname_command: hostname = subprocess.check_output(hostname_command, shell=True).strip() config = Configurator(settings=settings) from snovault.elasticsearch import APP_FACTORY config.registry[APP_FACTORY] = main # used by mp_indexer config.include(app_version) config.include('pyramid_multiauth') # must be before calling set_authorization_policy from pyramid_localroles import LocalRolesAuthorizationPolicy # Override default authz policy set by pyramid_multiauth config.set_authorization_policy(LocalRolesAuthorizationPolicy()) config.include(session) config.include(configure_dbsession) config.include('snovault') config.commit() # commit so search can override listing # Render an HTML page to browsers and a JSON document for API clients config.include('.renderers') config.include('snovault.authentication') config.include('.server_defaults') config.include('.types') config.include('.root') if 'elasticsearch.server' in config.registry.settings: config.include('snovault.elasticsearch') config.include('snowflakes.viewconfigs.views') config.include(static_resources) config.include(changelogs) aws_ip_ranges = json_from_path(settings.get('aws_ip_ranges_path'), {'prefixes': []}) config.registry['aws_ipset'] = netaddr.IPSet( record['ip_prefix'] for record in aws_ip_ranges['prefixes'] if record['service'] == 'AMAZON') if asbool(settings.get('testing', False)): config.include('snovault.tests.testing_views') # Load upgrades last so that all views (including testing views) are # registered. config.include('.upgrade') config.include('.audit') app = config.make_wsgi_app() return app
def main(global_config, **local_config): """ This function returns a Pyramid WSGI application. """ settings = global_config settings.update(local_config) settings['snovault.jsonld.namespaces'] = json_asset('encoded:schemas/namespaces.json') settings['snovault.jsonld.terms_namespace'] = 'https://www.encodeproject.org/terms/' settings['snovault.jsonld.terms_prefix'] = 'encode' settings['snovault.elasticsearch.index'] = 'snovault' config = Configurator(settings=settings) from snovault.elasticsearch import APP_FACTORY config.registry[APP_FACTORY] = main # used by mp_indexer config.include(app_version) config.include('pyramid_multiauth') # must be before calling set_authorization_policy from pyramid_localroles import LocalRolesAuthorizationPolicy # Override default authz policy set by pyramid_multiauth config.set_authorization_policy(LocalRolesAuthorizationPolicy()) config.include(session) config.include('.auth0') config.include(configure_dbsession) config.include('snovault') config.commit() # commit so search can override listing # Render an HTML page to browsers and a JSON document for API clients config.include('.renderers') config.include('.authentication') config.include('.server_defaults') config.include('.types') config.include('.root') config.include('.batch_download') config.include('.visualization') if 'elasticsearch.server' in config.registry.settings: config.include('snovault.elasticsearch') config.include('.search') if 'snp_search.server' in config.registry.settings: addresses = aslist(config.registry.settings['snp_search.server']) config.registry['snp_search'] = Elasticsearch( addresses, serializer=PyramidJSONSerializer(json_renderer), connection_class=TimedUrllib3HttpConnection, retry_on_timeout=True, timeout=60, maxsize=50 ) config.include('.region_search') config.include('.peak_indexer') config.include(static_resources) config.include(changelogs) config.registry['ontology'] = json_from_path(settings.get('ontology_path'), {}) aws_ip_ranges = json_from_path(settings.get('aws_ip_ranges_path'), {'prefixes': []}) config.registry['aws_ipset'] = netaddr.IPSet( record['ip_prefix'] for record in aws_ip_ranges['prefixes'] if record['service'] == 'AMAZON') if asbool(settings.get('testing', False)): config.include('.tests.testing_views') # Load upgrades last so that all views (including testing views) are # registered. config.include('.upgrade') config.include('.audit') app = config.make_wsgi_app() workbook_filename = settings.get('load_workbook', '') load_test_only = asbool(settings.get('load_test_only', False)) docsdir = settings.get('load_docsdir', None) if docsdir is not None: docsdir = [path.strip() for path in docsdir.strip().split('\n')] if workbook_filename: load_workbook(app, workbook_filename, docsdir, test=load_test_only) return app
def main(global_config, **local_config): """ This function returns a Pyramid WSGI application. """ settings = global_config settings.update(local_config) settings['contentbase.jsonld.namespaces'] = json_asset('clincoded:schemas/namespaces.json') settings['contentbase.jsonld.terms_namespace'] = 'https://www.encodeproject.org/terms/' settings['contentbase.jsonld.terms_prefix'] = 'encode' settings['contentbase.elasticsearch.index'] = 'clincoded' config = Configurator(settings=settings) config.registry['app_factory'] = main # used by mp_indexer config.include('pyramid_multiauth') # must be before calling set_authorization_policy from pyramid_localroles import LocalRolesAuthorizationPolicy # Override default authz policy set by pyramid_multiauth config.set_authorization_policy(LocalRolesAuthorizationPolicy()) config.include(session) config.include('.auth0') configure_engine(settings) config.include('contentbase') config.commit() # commit so search can override listing # Render an HTML page to browsers and a JSON document for API clients config.include('.renderers') config.include('.authentication') config.include('.server_defaults') config.include('.types') config.include('.root') config.include('.batch_download') config.include('.visualization') config.include('.ldh') # config.include('.messaging') if 'elasticsearch.server' in config.registry.settings: config.include('contentbase.elasticsearch') config.include('.search') config.include(static_resources) config.include(changelogs) config.registry['ontology'] = json_from_path(settings.get('ontology_path'), {}) if asbool(settings.get('testing', False)): config.include('.tests.testing_views') # Load upgrades last so that all views (including testing views) are # registered. config.include('.upgrade') config.include('.audit') app = config.make_wsgi_app() workbook_filename = settings.get('load_workbook', '') load_test_only = asbool(settings.get('load_test_only', False)) docsdir = settings.get('load_docsdir', None) if docsdir is not None: docsdir = [path.strip() for path in docsdir.strip().split('\n')] if workbook_filename: load_workbook(app, workbook_filename, docsdir, test=load_test_only) return app
def main(global_config, **local_config): """ This function returns a Pyramid WSGI application. """ settings = global_config settings.update(local_config) config = Configurator(settings=settings) config.include(session) config.include('pyramid_tm') configure_engine(settings) # Render an HTML page to browsers and a JSON document for API clients config.include('.calculated') config.include('.embedding') config.include('.renderers') config.include('.authentication') config.include('.validation') config.include('.predicates') config.include('.contentbase') config.include('.indexing') config.include('.server_defaults') config.include('.types') config.include('.views') config.include('.migrator') config.include('.auditor') settings = config.registry.settings hostname_command = settings.get('hostname_command', '').strip() if hostname_command: hostname = subprocess.check_output(hostname_command, shell=True).strip() settings.setdefault('persona.audiences', '') settings['persona.audiences'] += '\nhttp://%s' % hostname settings['persona.audiences'] += '\nhttp://%s:6543' % hostname config.include('.persona') config.include('pyramid_multiauth') from pyramid_localroles import LocalRolesAuthorizationPolicy config.set_authorization_policy(LocalRolesAuthorizationPolicy()) config.include(static_resources) config.include(load_ontology) if asbool(settings.get('testing', False)): config.include('.tests.testing_views') # Load upgrades last so that all views (including testing views) are # registered. config.include('.upgrade') config.include('.audit') app = config.make_wsgi_app() if asbool(settings.get('load_sample_data', False)): load_sample_data(app) workbook_filename = settings.get('load_workbook', '') load_test_only = asbool(settings.get('load_test_only', False)) docsdir = settings.get('load_docsdir', None) if docsdir is not None: docsdir = [path.strip() for path in docsdir.strip().split('\n')] if workbook_filename: load_workbook(app, workbook_filename, docsdir, test=load_test_only) return app