From c05efd2f97ddda9640fc0600dd8c68b381e7bac7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Albert?= Date: Thu, 30 Jun 2016 17:34:27 +0200 Subject: [PATCH] Fix port hardcoded on APILink sample Now the sample will reflect what's in the configuration. Change-Id: Ia72baca546dfa1f052e0a646017810d91fcab97b --- cloudkitty/api/root.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cloudkitty/api/root.py b/cloudkitty/api/root.py index 42deab32..df23ac38 100644 --- a/cloudkitty/api/root.py +++ b/cloudkitty/api/root.py @@ -15,6 +15,7 @@ # # @author: Stéphane Albert # +from oslo_config import cfg import pecan from pecan import rest from wsme import types as wtypes @@ -22,6 +23,9 @@ import wsmeext.pecan as wsme_pecan from cloudkitty.api.v1 import controllers as v1_api +CONF = cfg.CONF +CONF.import_opt('port', 'cloudkitty.api.app', 'api') + class APILink(wtypes.Base): """API link description. @@ -43,7 +47,8 @@ class APILink(wtypes.Base): sample = cls( rel='self', type='text/html', - href='http://127.0.0.1:8889/{id}'.format( + href='http://127.0.0.1:{port}/{id}'.format( + port=CONF.api.port, id=version)) return sample