diff options
author | Zhao Chao <zhaochao1984@gmail.com> | 2018-02-07 11:07:02 +0800 |
---|---|---|
committer | Zhao Chao <zhaochao1984@gmail.com> | 2018-02-07 11:31:45 +0800 |
commit | 1667ad5e80be7d0bf3ac8e02410a18ce3a0ea4cd (patch) | |
tree | f854845e10a282715e93fcee2c52b294c0d03932 /trove/common/cfg.py | |
parent | e8df4126f5b885540e80b0697a28a24eee28b42a (diff) | |
download | trove-1667ad5e80be7d0bf3ac8e02410a18ce3a0ea4cd.tar.gz |
Allow host URL for versions to be configurable
The versions resource constructs the links by using application_url,
but it's possible that the API endpoint is behind a load balancer
or SSL terminator. This means that the application_url might be
incorrect. This fix provides a config option (similar to other
services) which lets us override the host URL when constructing
links for the versions API.
Co-Authored-By: Nikhil Manchanda <SlickNik@gmail.com>
Change-Id: I23f06c6c2d52ba46c74e0d097c4963d2de731d30
Closes-bug: 1384379
Diffstat (limited to 'trove/common/cfg.py')
-rw-r--r-- | trove/common/cfg.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/trove/common/cfg.py b/trove/common/cfg.py index a3384a95..b2371eda 100644 --- a/trove/common/cfg.py +++ b/trove/common/cfg.py @@ -44,6 +44,15 @@ path_opts = [ help='Directory where the Trove python module is installed.'), ] +versions_opts = [ + cfg.StrOpt('public_endpoint', default=None, + help='Public URL to use for versions endpoint. The default ' + 'is None, which will use the request\'s host_url ' + 'attribute to populate the URL base. If Trove is ' + 'operating behind a proxy, you will want to change ' + 'this to represent the proxy\'s URL.') +] + common_opts = [ cfg.IPOpt('bind_host', default='0.0.0.0', help='IP address the API server will listen on.'), @@ -1526,6 +1535,7 @@ rpcapi_cap_opts = [ CONF = cfg.CONF CONF.register_opts(path_opts) +CONF.register_opts(versions_opts) CONF.register_opts(common_opts) CONF.register_opts(database_opts, 'database') |