Merge pull request #399 from eReuse/bugfix/4042-new-var-in-environment

put api_host in config
This commit is contained in:
cayop 2022-11-07 17:34:19 +01:00 committed by GitHub
commit 48de1d5f47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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']