Make the upgrade check key configurable.

This commit is contained in:
Dave Page 2019-01-02 12:56:39 +00:00
parent 6e5b54eb1a
commit d7da8be486
2 changed files with 7 additions and 3 deletions

View File

@ -304,6 +304,9 @@ UPGRADE_CHECK_ENABLED = True
# Where should we get the data from?
UPGRADE_CHECK_URL = 'https://www.pgadmin.org/versions.json'
# What key should we look at in the upgrade data file?
UPGRADE_CHECK_KEY = 'pgadmin4'
# Which CA file should we use?
# Default to cacert.pem in the same directory as config.py et al.
CA_FILE = os.path.join(os.path.dirname(os.path.realpath(__file__)),

View File

@ -519,13 +519,14 @@ def index():
current_app.logger.exception('Exception when checking for update')
if data is not None:
if data['pgadmin4']['version_int'] > config.APP_VERSION_INT:
if data[config.UPGRADE_CHECK_KEY]['version_int'] > \
config.APP_VERSION_INT:
msg = render_template(
MODULE_NAME + "/upgrade.html",
current_version=config.APP_VERSION,
upgrade_version=data['pgadmin4']['version'],
upgrade_version=data[config.UPGRADE_CHECK_KEY]['version'],
product_name=config.APP_NAME,
download_url=data['pgadmin4']['download_url']
download_url=data[config.UPGRADE_CHECK_KEY]['download_url']
)
flash(msg, 'warning')