Skip to content

Configurations

AleksiP edited this page Aug 20, 2021 · 14 revisions

Configurations

Since servicemap-ui is in use for multiple organizations we have multiple feature that can be activated by environment variables. Here you can find out what different configurations can be set and how they affect servicemap-ui.

Environment variables:

Variable Default Description
COOKIEHUB_DOMAINS null COOKIEHUB_DOMAINS is array of domains specific cookiehub urls separated by ;. Each element has 2 parts domain and url separated by ,. For example domain1,url1;domain2,url2. This configuration can be used to add separated CookieHub scripts based on domains.
DOMAIN_MAP_POSITIONS null DOMAIN_MAP_POSITIONS is array of arrays in string format. Using format domain1,lat1,lon1;domain2,lat2,lon2. This compares domain name to request hostname and in case of true sets given latitude and longitude values as initial map position.
FEEDBACK_IS_PUBLISHED true Defines if feedback form should have can_be_published field. If set to false form will always send can_be_published as false
NATURE_AREA_URL null URL for adding links to correct nature area site based on area's origin_id
USE_PTV_ACCESSIBILITY_API false  Defines if accessibility sentences are set to fetch from PTV API or not. Requires that ACCESSIBILITY_SENTENCE_API is also set to point to PTV API.
REITTIOPAS_URL https://reittiopas.hsl.fi/reitti/ Root URL for Journey Planner used for creating Journey Planner links for location page.

Overriding default translations

Static texts which are shown in Servicemap can be found in src/i18n/ folder in language specific files fi.js, en.js, sv.js.

If you want to override specific texts you need to:

  1. First create a folder named externalTranslations in src/i18n if it doesn't exist.
  2. Then create a JSON file named with same language short as the main file ie. src/i18n/externalTranslations/fi.json.
  3. In fi.json file you can add language specific texts that override main texts by using same key as in main file ie "app.description": "New app description"

Now when translations are imported by script it will combine both JSON objects in a way where externalTranslations override existing keys and return a single object.

Notes: Having externalTranslations folder in src might not be best practice if there are ideas to improve this or different solutions we should take a look at those.

Clone this wiki locally