def setup_app(config=None): if not config: config = get_pecan_config() m_config.set_config_defaults() app_conf = dict(config.app) db_api_v2.setup_db() if not app_conf.pop('disable_cron_trigger_thread', False): periodic.setup() coordination.Service('api_group').register_membership() app = pecan.make_app( app_conf.pop('root'), hooks=lambda: [ctx.ContextHook(), ctx.AuthHook()], logging=getattr(config, 'logging', {}), **app_conf) # Set up access control. app = access_control.setup(app) # Set up profiler. if cfg.CONF.profiler.enabled: app = osprofiler.web.WsgiMiddleware( app, hmac_keys=cfg.CONF.profiler.hmac_keys, enabled=cfg.CONF.profiler.enabled) # Create a CORS wrapper, and attach mistral-specific defaults that must be # included in all CORS responses. return cors_middleware.CORS(app, cfg.CONF)
def setup_app(config=None): if not config: config = get_pecan_config() m_config.set_config_defaults() app_conf = dict(config.app) db_api_v2.setup_db() # TODO(rakhmerov): Why do we run cron triggers in the API layer? # Should we move it to engine?s if cfg.CONF.cron_trigger.enabled: periodic.setup() coordination.Service('api_group').register_membership() app = pecan.make_app( app_conf.pop('root'), hooks=lambda: [ctx.AuthHook(), ctx.ContextHook()], logging=getattr(config, 'logging', {}), **app_conf) # Set up access control. app = access_control.setup(app) # TODO(rakhmerov): need to get rid of this call. # Set up RPC related flags in config rpc.get_transport() # Set up profiler. if cfg.CONF.profiler.enabled: app = osprofiler.web.WsgiMiddleware( app, hmac_keys=cfg.CONF.profiler.hmac_keys, enabled=cfg.CONF.profiler.enabled) # Create HTTPProxyToWSGI wrapper app = http_proxy_to_wsgi_middleware.HTTPProxyToWSGI(app, cfg.CONF) # Create a CORS wrapper, and attach mistral-specific defaults that must be # included in all CORS responses. return cors_middleware.CORS(app, cfg.CONF)
def setup_app(config=None): if not config: config = get_pecan_config() app_conf = dict(config.app) db_api_v2.setup_db() periodic.setup() app = pecan.make_app( app_conf.pop('root'), hooks=lambda: [ctx.ContextHook(), ctx.AuthHook()], logging=getattr(config, 'logging', {}), **app_conf) # Set up access control. app = access_control.setup(app) return app
def setup_app(config=None, transport=None): if not config: config = get_pecan_config() app_conf = dict(config.app) db_api.setup_db() ##TODO(akuznetsov) move this to trigger scheduling to separate process periodic.setup(transport) app = pecan.make_app( app_conf.pop('root'), hooks=lambda: [ctx.ContextHook(), engine.EngineHook(transport=transport)], logging=getattr(config, 'logging', {}), **app_conf) # Set up access control. app = access_control.setup(app) return app
def setup_app(config=None): if not config: config = get_pecan_config() app_conf = dict(config.app) db_api_v2.setup_db() periodic.setup() coordination.Service('api_group').register_membership() app = pecan.make_app( app_conf.pop('root'), hooks=lambda: [ctx.ContextHook(), ctx.AuthHook()], logging=getattr(config, 'logging', {}), **app_conf) # Set up access control. app = access_control.setup(app) # Create a CORS wrapper, and attach mistral-specific defaults that must be # included in all CORS responses. app = cors_middleware.CORS(app, cfg.CONF) app.set_latent(allow_headers=[ 'X-Auth-Token', 'X-Identity-Status', 'X-Roles', 'X-Service-Catalog', 'X-User-Id', 'X-Tenant-Id' 'X-Project-Id', 'X-User-Name', 'X-Project-Name' ], allow_methods=['GET', 'PUT', 'POST', 'DELETE', 'PATCH'], expose_headers=[ 'X-Auth-Token', 'X-Subject-Token', 'X-Service-Token', 'X-Project-Id', 'X-User-Name', 'X-Project-Name' ]) return app