Merge "Moved CORS middleware configuration into oslo-config-generator"
This commit is contained in:
commit
2768da320d
@ -17,9 +17,6 @@ paste.filter_factory = oslo_middleware:CatchErrors.factory
|
||||
[filter:cors]
|
||||
paste.filter_factory = oslo_middleware.cors:filter_factory
|
||||
oslo_config_project = neutron
|
||||
latent_allow_headers = X-Auth-Token, X-Identity-Status, X-Roles, X-Service-Catalog, X-User-Id, X-Tenant-Id, X-OpenStack-Request-ID
|
||||
latent_expose_headers = X-Auth-Token, X-Subject-Token, X-Service-Token, X-OpenStack-Request-ID
|
||||
latent_allow_methods = GET, PUT, POST, DELETE, PATCH
|
||||
|
||||
[filter:keystonecontext]
|
||||
paste.filter_factory = neutron.auth:NeutronKeystoneContext.factory
|
||||
|
@ -24,6 +24,7 @@ from oslo_config import cfg
|
||||
from oslo_db import options as db_options
|
||||
from oslo_log import log as logging
|
||||
import oslo_messaging
|
||||
from oslo_middleware import cors
|
||||
from oslo_service import wsgi
|
||||
|
||||
from neutron._i18n import _, _LI
|
||||
@ -269,6 +270,7 @@ def reset_service():
|
||||
# Note that this is called only in case a service is running in
|
||||
# daemon mode.
|
||||
setup_logging()
|
||||
set_config_defaults()
|
||||
policy.refresh()
|
||||
|
||||
|
||||
@ -280,3 +282,33 @@ def load_paste_app(app_name):
|
||||
loader = wsgi.Loader(cfg.CONF)
|
||||
app = loader.load_app(app_name)
|
||||
return app
|
||||
|
||||
|
||||
def set_config_defaults():
|
||||
"""This method updates all configuration default values."""
|
||||
set_cors_middleware_defaults()
|
||||
|
||||
|
||||
def set_cors_middleware_defaults():
|
||||
"""Update default configuration options for oslo.middleware."""
|
||||
# CORS Defaults
|
||||
# TODO(krotscheck): Update with https://review.openstack.org/#/c/285368/
|
||||
cfg.set_defaults(cors.CORS_OPTS,
|
||||
allow_headers=['X-Auth-Token',
|
||||
'X-Identity-Status',
|
||||
'X-Roles',
|
||||
'X-Service-Catalog',
|
||||
'X-User-Id',
|
||||
'X-Tenant-Id',
|
||||
'X-OpenStack-Request-ID'],
|
||||
expose_headers=['X-Auth-Token',
|
||||
'X-Subject-Token',
|
||||
'X-Service-Token',
|
||||
'X-OpenStack-Request-ID',
|
||||
'OpenStack-Volume-microversion'],
|
||||
allow_methods=['GET',
|
||||
'PUT',
|
||||
'POST',
|
||||
'DELETE',
|
||||
'PATCH']
|
||||
)
|
||||
|
@ -28,6 +28,7 @@ def boot_server(server_func):
|
||||
# the configuration will be read into the cfg.CONF global data structure
|
||||
config.init(sys.argv[1:])
|
||||
config.setup_logging()
|
||||
config.set_config_defaults()
|
||||
if not cfg.CONF.config_file:
|
||||
sys.exit(_("ERROR: Unable to find configuration file via the default"
|
||||
" search paths (~/.neutron/, ~/, /etc/neutron/, /etc/) and"
|
||||
|
@ -149,6 +149,8 @@ oslo.config.opts =
|
||||
neutron.ml2.sriov.agent = neutron.opts:list_sriov_agent_opts
|
||||
neutron.qos = neutron.opts:list_qos_opts
|
||||
nova.auth = neutron.opts:list_auth_opts
|
||||
oslo.config.opts.defaults =
|
||||
oslo.middleware.cors = neutron.common.config:set_cors_middleware_defaults
|
||||
neutron.db.alembic_migrations =
|
||||
neutron = neutron.db.migration:alembic_migrations
|
||||
neutron.interface_drivers =
|
||||
|
Loading…
Reference in New Issue
Block a user