From f2d7d3592a1c6d1d14ba7d1a9348aa4cfd56bfde Mon Sep 17 00:00:00 2001 From: Disassembler Date: Sat, 12 Mar 2022 18:20:28 +0100 Subject: [PATCH] Prevent map error when Bing layer is enabled and API key not set, resolves #5 --- .env | 1 + .../srv/web2py/applications/eden/models/000_config.py | 6 +++--- .../srv/web2py/applications/eden/models/000_config.py | 6 +++--- sahana/image.d/etc/sudoers.d/sahana | 1 + .../srv/web2py/applications/eden/models/000_config.py | 6 +++--- 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/.env b/.env index b2525a1..a46bec8 100644 --- a/.env +++ b/.env @@ -12,6 +12,7 @@ SAHANA_MAIL_LOGIN=username:password SAHANA_MAIL_SENDER='Sahana' SAHANA_MAIL_APPROVER=useradmin@example.org +SAHANA_API_KEY_BING= SAHANA_API_KEY_GOOGLE= SAHANA_API_KEY_OPENWEATHERMAP= diff --git a/sahana-sambro/image.d/srv/web2py/applications/eden/models/000_config.py b/sahana-sambro/image.d/srv/web2py/applications/eden/models/000_config.py index f2dbd16..a604797 100644 --- a/sahana-sambro/image.d/srv/web2py/applications/eden/models/000_config.py +++ b/sahana-sambro/image.d/srv/web2py/applications/eden/models/000_config.py @@ -117,13 +117,13 @@ settings.mail.approver = os.getenv("SAHANA_MAIL_APPROVER") or "useradmin@example # Bing API Key (for Map layers) # http://www.microsoft.com/maps/create-a-bing-maps-key.aspx -#settings.gis.api_bing = "" +settings.gis.api_bing = os.getenv("SAHANA_API_KEY_BING") or "missing_api_key" # GetAddress API Key (for GetAddress.io Postcode to Address lookup) #settings.gis.api_getaddress = "" # Google API Key (for Google Maps Layers) -settings.gis.api_google = os.getenv("SAHANA_API_KEY_GOOGLE") or "" +settings.gis.api_google = os.getenv("SAHANA_API_KEY_GOOGLE") or "missing_api_key" # OpenWeatherMap API Key (for OpenWeatherMap Layers) -settings.gis.api_openweathermap = os.getenv("SAHANA_API_KEY_OPENWEATHERMAP") or "" +settings.gis.api_openweathermap = os.getenv("SAHANA_API_KEY_OPENWEATHERMAP") or "missing_api_key" # GeoNames username #settings.gis.geonames_username = "" diff --git a/sahana-spotter/image.d/srv/web2py/applications/eden/models/000_config.py b/sahana-spotter/image.d/srv/web2py/applications/eden/models/000_config.py index 96d8c75..16fc26b 100644 --- a/sahana-spotter/image.d/srv/web2py/applications/eden/models/000_config.py +++ b/sahana-spotter/image.d/srv/web2py/applications/eden/models/000_config.py @@ -117,13 +117,13 @@ settings.mail.approver = os.getenv("SAHANA_MAIL_APPROVER") or "useradmin@example # Bing API Key (for Map layers) # http://www.microsoft.com/maps/create-a-bing-maps-key.aspx -#settings.gis.api_bing = "" +settings.gis.api_bing = os.getenv("SAHANA_API_KEY_BING") or "missing_api_key" # GetAddress API Key (for GetAddress.io Postcode to Address lookup) #settings.gis.api_getaddress = "" # Google API Key (for Google Maps Layers) -settings.gis.api_google = os.getenv("SAHANA_API_KEY_GOOGLE") or "" +settings.gis.api_google = os.getenv("SAHANA_API_KEY_GOOGLE") or "missing_api_key" # OpenWeatherMap API Key (for OpenWeatherMap Layers) -settings.gis.api_openweathermap = os.getenv("SAHANA_API_KEY_OPENWEATHERMAP") or "" +settings.gis.api_openweathermap = os.getenv("SAHANA_API_KEY_OPENWEATHERMAP") or "missing_api_key" # GeoNames username #settings.gis.geonames_username = "" diff --git a/sahana/image.d/etc/sudoers.d/sahana b/sahana/image.d/etc/sudoers.d/sahana index a04ee36..0512884 100644 --- a/sahana/image.d/etc/sudoers.d/sahana +++ b/sahana/image.d/etc/sudoers.d/sahana @@ -7,6 +7,7 @@ Defaults env_keep += "SAHANA_MAIL_HOST" Defaults env_keep += "SAHANA_MAIL_LOGIN" Defaults env_keep += "SAHANA_MAIL_SENDER" Defaults env_keep += "SAHANA_MAIL_APPROVER" +Defaults env_keep += "SAHANA_API_KEY_BING" Defaults env_keep += "SAHANA_API_KEY_GOOGLE" Defaults env_keep += "SAHANA_API_KEY_OPENWEATHERMAP" Defaults env_keep += "SAHANA_PUBLIC_URL" diff --git a/sahana/image.d/srv/web2py/applications/eden/models/000_config.py b/sahana/image.d/srv/web2py/applications/eden/models/000_config.py index ea7e57c..8a01fb0 100644 --- a/sahana/image.d/srv/web2py/applications/eden/models/000_config.py +++ b/sahana/image.d/srv/web2py/applications/eden/models/000_config.py @@ -117,13 +117,13 @@ settings.mail.approver = os.getenv("SAHANA_MAIL_APPROVER") or "useradmin@example # Bing API Key (for Map layers) # http://www.microsoft.com/maps/create-a-bing-maps-key.aspx -#settings.gis.api_bing = "" +settings.gis.api_bing = os.getenv("SAHANA_API_KEY_BING") or "missing_api_key" # GetAddress API Key (for GetAddress.io Postcode to Address lookup) #settings.gis.api_getaddress = "" # Google API Key (for Google Maps Layers) -settings.gis.api_google = os.getenv("SAHANA_API_KEY_GOOGLE") or "" +settings.gis.api_google = os.getenv("SAHANA_API_KEY_GOOGLE") or "missing_api_key" # OpenWeatherMap API Key (for OpenWeatherMap Layers) -settings.gis.api_openweathermap = os.getenv("SAHANA_API_KEY_OPENWEATHERMAP") or "" +settings.gis.api_openweathermap = os.getenv("SAHANA_API_KEY_OPENWEATHERMAP") or "missing_api_key" # GeoNames username #settings.gis.geonames_username = ""