Add oslo_config program support to paste middleware
oslo_config's configfile autodiscovery permits an additional parameter named 'prog', which will add an additional file name to the possible files that are checked in oslo_config directories. This patch adds this parameter to paste-ini initialization, permitting access to more configuration files. This feature is required by glance, as glance does not make use of ./glance/glance.conf. Instead, they use ./glance/glance-api.conf. The appropriate middleware configuration in this case would then be: oslo_config_project=glance oslog_config_program=glance-api Change-Id: Ie530e4fac8076dc46b705770d12940ef91cb4644
This commit is contained in:
parent
ae44f8ce50
commit
7404a37e70
@ -104,6 +104,16 @@ will add CORS support. To add multiple domains, simply add another filter.::
|
||||
allow_headers=Content-Type,Cache-Control,Content-Language,Expires,Last-Modified,Pragma,X-Custom-Header
|
||||
expose_headers=Content-Type,Cache-Control,Content-Language,Expires,Last-Modified,Pragma,X-Custom-Header
|
||||
|
||||
If your application is using pastedeploy, but would also like to use the
|
||||
existing configuration from oslo_config in order to simplify the points of
|
||||
configuration, this may be done as follows.::
|
||||
|
||||
[filter:cors]
|
||||
paste.filter_factory = oslo_middleware.cors:filter_factory
|
||||
oslo_config_project = oslo_project_name
|
||||
|
||||
# Optional field, in case the program name is different from the project:
|
||||
oslo_config_program = oslo_project_name-api
|
||||
|
||||
Configuration Options
|
||||
---------------------
|
||||
|
@ -29,6 +29,10 @@ The paste filter (in /etc/my_app/api-paste.ini) will looks like::
|
||||
# the application configuration, by setting this:
|
||||
# oslo_config_project = my_app
|
||||
|
||||
# In some cases, you may need to specify the program name for the project
|
||||
# as well.
|
||||
# oslo_config_program = my_app-api
|
||||
|
||||
The oslo.config file of the application (eg: /etc/my_app/my_app.conf) will looks like::
|
||||
|
||||
[oslo_middleware]
|
||||
|
@ -67,8 +67,16 @@ class ConfigurableMiddleware(object):
|
||||
default_config_files = [self.conf['oslo_config_file']]
|
||||
else:
|
||||
default_config_files = None
|
||||
|
||||
if 'oslo_config_program' in self.conf:
|
||||
program = self.conf['oslo_config_program']
|
||||
else:
|
||||
program = None
|
||||
|
||||
self.oslo_conf = cfg.ConfigOpts()
|
||||
self.oslo_conf([], project=self.conf['oslo_config_project'],
|
||||
self.oslo_conf([],
|
||||
project=self.conf['oslo_config_project'],
|
||||
prog=program,
|
||||
default_config_files=default_config_files,
|
||||
validate_default_values=True)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user