diff --git a/docs/source/reference/configuration.rst b/docs/source/reference/configuration.rst index f22c97dd..5f3b4625 100644 --- a/docs/source/reference/configuration.rst +++ b/docs/source/reference/configuration.rst @@ -169,7 +169,7 @@ 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 @@ -177,6 +177,9 @@ Web application configuration provides the ability to customize web components. WIS2BOX_BASEMAP_ATTRIBUTION="OpenStreetMap 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 ^^^^^ diff --git a/wis2box-create-config.py b/wis2box-create-config.py index 304c17c3..534d1ab3 100644 --- a/wis2box-create-config.py +++ b/wis2box-create-config.py @@ -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: """ @@ -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')