rest: enable CORS middleware without Paste
It's impossible to pass a ConfigObj via Paste, so let's just embed it in our application directly. Change-Id: Iac4bc42102b02e996159e65df223ae09a2ca10d5
This commit is contained in:
parent
2aa755356e
commit
db0eb3fdc1
|
@ -13,10 +13,10 @@ use = egg:Paste#urlmap
|
|||
/v1 = gnocchiv1+auth
|
||||
|
||||
[pipeline:gnocchiv1+noauth]
|
||||
pipeline = cors gnocchiv1
|
||||
pipeline = gnocchiv1
|
||||
|
||||
[pipeline:gnocchiv1+auth]
|
||||
pipeline = cors keystone_authtoken gnocchiv1
|
||||
pipeline = keystone_authtoken gnocchiv1
|
||||
|
||||
[app:gnocchiversions]
|
||||
paste.app_factory = gnocchi.rest.app:app_factory
|
||||
|
@ -29,7 +29,3 @@ root = gnocchi.rest.V1Controller
|
|||
[filter:keystone_authtoken]
|
||||
paste.filter_factory = keystonemiddleware.auth_token:filter_factory
|
||||
oslo_config_project = gnocchi
|
||||
|
||||
[filter:cors]
|
||||
paste.filter_factory = oslo_middleware.cors:filter_factory
|
||||
oslo_config_project = gnocchi
|
||||
|
|
|
@ -18,6 +18,7 @@ import uuid
|
|||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log
|
||||
from oslo_middleware import cors
|
||||
from oslo_policy import policy
|
||||
from paste import deploy
|
||||
import pecan
|
||||
|
@ -128,7 +129,8 @@ def _setup_app(root, conf, indexer, storage, not_implemented_middleware):
|
|||
def app_factory(global_config, **local_conf):
|
||||
global APPCONFIGS
|
||||
appconfig = APPCONFIGS.get(global_config.get('configkey'))
|
||||
return _setup_app(root=local_conf.get('root'), **appconfig)
|
||||
app = _setup_app(root=local_conf.get('root'), **appconfig)
|
||||
return cors.CORS(app, conf=appconfig['conf'])
|
||||
|
||||
|
||||
def build_wsgi_app():
|
||||
|
|
Loading…
Reference in New Issue