diff options
author | Jenkins <jenkins@review.openstack.org> | 2016-07-11 21:15:24 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2016-07-11 21:15:24 +0000 |
commit | 41edb0aecd7e86ccedda249b827f1f8eb1679ad4 (patch) | |
tree | d8bf4390f5cafa5693412556d6988ac40368ff89 | |
parent | 6ca6c884054ed1b5e0c8b5d34cc8328695642664 (diff) | |
parent | 399e94043fdf40f413f0335387b1d92f0dd215ce (diff) | |
download | oslo-middleware-41edb0aecd7e86ccedda249b827f1f8eb1679ad4.tar.gz |
Merge "Deprecate multiple config block parsing."
-rw-r--r-- | doc/source/cors.rst | 26 | ||||
-rw-r--r-- | oslo_middleware/cors.py | 6 |
2 files changed, 7 insertions, 25 deletions
diff --git a/doc/source/cors.rst b/doc/source/cors.rst index 2788096..765a681 100644 --- a/doc/source/cors.rst +++ b/doc/source/cors.rst @@ -45,7 +45,7 @@ domain, using oslo_config:: app = cors.CORS(your_wsgi_application, cfg.CONF) -In your application's config file, then include a default configuration block +In your application's config file, then include a configuration block something like this:: [cors] @@ -55,30 +55,6 @@ something like this:: allow_headers=X-Custom-Header expose_headers=X-Custom-Header -This middleware permits you to override the rules for multiple -`allowed_origin`'s. To express this in your configuration file, first begin -with a `[cors]` group as above, into which you place your default -configuration values. Then add as many additional configuration groups as -necessary, naming them `[cors.something]` (each name must be unique). The -purpose of the suffix to `cors.` is legibility, we recommend using a -reasonable human-readable string:: - - [cors.ironic_webclient] - # CORS Configuration for a hypothetical ironic webclient, which overrides - # authentication - allowed_origin=https://ironic.example.com:443 - allow_credentials=True - - [cors.horizon] - # CORS Configuration for horizon, which uses global options. - allowed_origin=https://horizon.example.com:443 - - [cors.wildcard] - # CORS Configuration for the CORS specified domain wildcard, which only - # permits HTTP GET requests. - allowed_origin=* - allow_methods=GET - If your software requires specific headers or methods for proper operation, you may include these as latent properties. These will be evaluated in addition to any found in configuration:: diff --git a/oslo_middleware/cors.py b/oslo_middleware/cors.py index 90d0a89..863ae66 100644 --- a/oslo_middleware/cors.py +++ b/oslo_middleware/cors.py @@ -16,6 +16,7 @@ import copy import logging +import debtcollector from oslo_config import cfg from oslo_middleware import base import six @@ -198,6 +199,11 @@ class CORS(base.ConfigurableMiddleware): # prefixed with 'cors.' for section in self.oslo_conf.list_all_sections(): if section.startswith('cors.'): + debtcollector.deprecate('Multiple configuration blocks are ' + 'deprecated and will be removed in ' + 'future versions. Please consolidate ' + 'your configuration in the [cors] ' + 'configuration block.') # Register with the preconstructed defaults self.oslo_conf.register_opts(subgroup_opts, section) self.add_origin(**self.oslo_conf[section]) |