Skip to content

Commit

Permalink
Update per UI variables
Browse files Browse the repository at this point in the history
  • Loading branch information
webb-ben committed Dec 20, 2024
1 parent c079059 commit 28b0efd
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
5 changes: 4 additions & 1 deletion docs/source/reference/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -169,14 +169,17 @@ Restart the mosquitto container for the changes to take effect with the command:
Web application
^^^^^^^^^^^^^^^

Web application configuration provides the ability to customize web components.
Web application configuration provides the ability to customize web components. All of these are optional.

.. code-block:: bash
WIS2BOX_BASEMAP_URL="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png" # URL of map tile server to use
WIS2BOX_BASEMAP_ATTRIBUTION="<a href="https://osm.org/copyright">OpenStreetMap</a> contributors" # attribution of map tile server
WIS2BOX_UI_CLUSTER=False # default setting of the cluster toggle
WIS2BOX_UI_LANG="en" # default language, one of: ar, en, es, fr, ru, zh
WIS2BOX_LOGO=http://example.com/logo.png # use custom organization logo in the UI
WIS2BOX_CUSTOM_BACKGROUND_COLOR="#014e9e" # use custom background color for header and footer
WIS2BOX_DISABLE_SEPARATOR_IMAGE=false # boolean to disable WMO separator
Other
^^^^^
Expand Down
26 changes: 25 additions & 1 deletion wis2box-create-config.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,29 @@ def get_wis2box_url() -> str:

return wis2box_url

def get_custom_ui_logo():
"""
Prompt the user to enter a custom UI logo path or URL.
:returns: string or URL logo
"""
while True:
logo = input("Enter the path or URL for the custom UI logo (leave blank to skip): ").strip()
confirm = input(f"Confirm custom UI logo: '{logo or 'Default'}'? (y/n): ").strip().lower()
if confirm == 'y':
return logo if logo else None

def get_default_ui_language():
"""Prompt the user to enter a default UI language and validate against possible values."""
valid_languages = ['en', 'fr', 'es', 'ar', 'zh', 'ru'] # Extend the list as needed
while True:
language = input("Enter the default UI language (e.g., 'fr' for French, 'ar' for Arabic, leave blank for 'en'): ").strip() or 'en'
if language in valid_languages:
confirm = input(f"Confirm default UI language: '{language}'? (y/n): ").strip().lower()
if confirm == 'y':
return language
else:
print(f"Invalid language. Please choose from: {', '.join(valid_languages)}.")

def create_wis2box_env(host_datadir: str) -> None:
"""
Expand All @@ -305,7 +328,8 @@ def create_wis2box_env(host_datadir: str) -> None:
fh.write('# wis2box public URL\n')
fh.write(f'WIS2BOX_URL={wis2box_url}\n')
fh.write('WIS2BOX_UI_CLUSTER=false\n')
fh.write('WIS2BOX_UI_LANG=en\n')
fh.write(f'WIS2BOX_LOGO="{get_custom_ui_logo() or ""}"\n')
fh.write(f'WIS2BOX_UI_LANG={get_default_ui_language()}\n')
fh.write('\n')
fh.write('# api\n')
fh.write('WIS2BOX_API_TYPE=pygeoapi\n')
Expand Down

0 comments on commit 28b0efd

Please sign in to comment.