put api_host in config

This commit is contained in:
Cayo Puigdefabregas 2022-11-07 17:08:03 +01:00
parent 41eb390e39
commit 79877d09a1
2 changed files with 3 additions and 2 deletions

View File

@ -59,6 +59,7 @@ class DevicehubConfig(Config):
) # type: str ) # type: str
SCHEMA = config('SCHEMA', 'dbtest') SCHEMA = config('SCHEMA', 'dbtest')
HOST = config('HOST', 'localhost') HOST = config('HOST', 'localhost')
API_HOST = config('API_HOST', 'localhost')
MIN_WORKBENCH = StrictVersion('11.0a1') # type: StrictVersion MIN_WORKBENCH = StrictVersion('11.0a1') # type: StrictVersion
"""The minimum version of ereuse.org workbench that this devicehub """The minimum version of ereuse.org workbench that this devicehub
accepts. we recommend not changing this value. accepts. we recommend not changing this value.

View File

@ -55,7 +55,7 @@ class SettingsView(GenericMixin):
return flask.render_template(self.template_name, **self.context) return flask.render_template(self.template_name, **self.context)
def download(self): def download(self):
url = "https://{}/api/inventory/".format(app.config['HOST']) url = "https://{}/api/inventory/".format(app.config['API_HOST'])
self.wbContext = { self.wbContext = {
'token': self.get_token(), 'token': self.get_token(),
'url': url, 'url': url,
@ -65,7 +65,7 @@ class SettingsView(GenericMixin):
# if is a v14 version # if is a v14 version
# TODO when not use more v14, we can remove this if # TODO when not use more v14, we can remove this if
if 'erease' in self.opt: if 'erease' in self.opt:
url = "https://{}/actions/".format(app.config['HOST']) url = "https://{}/actions/".format(app.config['API_HOST'])
self.wbContext['url'] = url self.wbContext['url'] = url
self.wbContext['host'] = app.config['HOST'] self.wbContext['host'] = app.config['HOST']
self.wbContext['schema'] = app.config['SCHEMA'] self.wbContext['schema'] = app.config['SCHEMA']