Prevent map error when Bing layer is enabled and API key not set,

resolves #5
This commit is contained in:
Disassembler 2022-03-12 18:20:28 +01:00
parent 60d9d2e2fb
commit f2d7d3592a
No known key found for this signature in database
GPG Key ID: 524BD33A0EE29499
5 changed files with 11 additions and 9 deletions

1
.env
View File

@ -12,6 +12,7 @@ SAHANA_MAIL_LOGIN=username:password
SAHANA_MAIL_SENDER='Sahana' <sahana@example.org> SAHANA_MAIL_SENDER='Sahana' <sahana@example.org>
SAHANA_MAIL_APPROVER=useradmin@example.org SAHANA_MAIL_APPROVER=useradmin@example.org
SAHANA_API_KEY_BING=
SAHANA_API_KEY_GOOGLE= SAHANA_API_KEY_GOOGLE=
SAHANA_API_KEY_OPENWEATHERMAP= SAHANA_API_KEY_OPENWEATHERMAP=

View File

@ -117,13 +117,13 @@ settings.mail.approver = os.getenv("SAHANA_MAIL_APPROVER") or "useradmin@example
# Bing API Key (for Map layers) # Bing API Key (for Map layers)
# http://www.microsoft.com/maps/create-a-bing-maps-key.aspx # 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) # GetAddress API Key (for GetAddress.io Postcode to Address lookup)
#settings.gis.api_getaddress = "" #settings.gis.api_getaddress = ""
# Google API Key (for Google Maps Layers) # 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) # 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 # GeoNames username
#settings.gis.geonames_username = "" #settings.gis.geonames_username = ""

View File

@ -117,13 +117,13 @@ settings.mail.approver = os.getenv("SAHANA_MAIL_APPROVER") or "useradmin@example
# Bing API Key (for Map layers) # Bing API Key (for Map layers)
# http://www.microsoft.com/maps/create-a-bing-maps-key.aspx # 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) # GetAddress API Key (for GetAddress.io Postcode to Address lookup)
#settings.gis.api_getaddress = "" #settings.gis.api_getaddress = ""
# Google API Key (for Google Maps Layers) # 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) # 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 # GeoNames username
#settings.gis.geonames_username = "" #settings.gis.geonames_username = ""

View File

@ -7,6 +7,7 @@ Defaults env_keep += "SAHANA_MAIL_HOST"
Defaults env_keep += "SAHANA_MAIL_LOGIN" Defaults env_keep += "SAHANA_MAIL_LOGIN"
Defaults env_keep += "SAHANA_MAIL_SENDER" Defaults env_keep += "SAHANA_MAIL_SENDER"
Defaults env_keep += "SAHANA_MAIL_APPROVER" 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_GOOGLE"
Defaults env_keep += "SAHANA_API_KEY_OPENWEATHERMAP" Defaults env_keep += "SAHANA_API_KEY_OPENWEATHERMAP"
Defaults env_keep += "SAHANA_PUBLIC_URL" Defaults env_keep += "SAHANA_PUBLIC_URL"

View File

@ -117,13 +117,13 @@ settings.mail.approver = os.getenv("SAHANA_MAIL_APPROVER") or "useradmin@example
# Bing API Key (for Map layers) # Bing API Key (for Map layers)
# http://www.microsoft.com/maps/create-a-bing-maps-key.aspx # 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) # GetAddress API Key (for GetAddress.io Postcode to Address lookup)
#settings.gis.api_getaddress = "" #settings.gis.api_getaddress = ""
# Google API Key (for Google Maps Layers) # 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) # 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 # GeoNames username
#settings.gis.geonames_username = "" #settings.gis.geonames_username = ""