OpenCRVS
v1.2
Search
⌃K

3.2.8 Set up initialisation settings

The final required step in setting up your country configuration repository before moving onto hosting and/or application configuration is to set up some initialisation settings that the application requires.
The OpenCRVS Core Login application loads the following config js files before connecting to the OpenCRVS backend to serve all the content.
Login app - local development: login-config.js
window.config = {
AUTH_API_URL: 'http://localhost:4040/',
CONFIG_API_URL: 'http://localhost:2021',
COUNTRY: 'FAR',
LANGUAGES: 'en,fr',
AVAILABLE_LANGUAGES_SELECT: 'en:English,fr:Français',
CLIENT_APP_URL: 'http://localhost:3000/',
COUNTRY_CONFIG_URL: 'http://localhost:3040',
SENTRY:
'https://f892d643aab64[email protected]/1774604',
LOGROCKET: 'opencrvs-foundation/opencrvs-farajaland',
}
As you can see, the React Login application uses the URL values to understand how to connect to backend services such as the login authentication API and the country configuration API.
You must set 3 values:
COUNTRY: Set the Alpha 3 country code to be the same as the value you used when importing the set up files in step 3.2.5. The Login app needs to convert users phone numbers into MSISDN numbers using an Alpha 3 country code in case the user forgets their login details and requires an SMS reset.
LANGUAGES: This property allows you to customise the global language options. This value is a comma separated string of ISO 639-1 language codes for every translation you have set up in step 3.2.7 Set-up language content .
For example, if you wanted to support Spanish and English, with Spanish being the default this string should be:
es,en
AVAILABLE_LANGUAGES_SELECT: The app needs to populate available languages in a language select before it has had a chance to load any language content. This property allows you to customise the options & labels in the select. This value is a comma separated string of the following:
a) Firstly the ISO 639-1 language code for a single translation you have set up in step 3.2.7 Set-up language content followed by a colon.
b) After the colon, the displayName for the language.
For example, if you wanted to support Spanish and English, with Spanish being the default this string should be:
es:Español,en:English
Finally you can configure an optional Sentry and Logrocket link in order to track any unexpected errors in your application in those 3rd party monitoring tools.
Login app - production: login-config.prod.js
window.config = {
AUTH_API_URL: 'https://auth.{{hostname}}/',
CONFIG_API_URL: 'https://config.{{hostname}}',
COUNTRY: 'FAR',
LANGUAGES: 'en,fr',
AVAILABLE_LANGUAGES_SELECT: 'en:English,fr:Français',
CLIENT_APP_URL: 'https://register.{{hostname}}/',
COUNTRY_CONFIG_URL: 'https://countryconfig.{{hostname}}',
SENTRY:
'https://[email protected]/1774604',
LOGROCKET: 'opencrvs-foundation/opencrvs-farajaland',
}
As you can see, the production config file contains the same settings.
You may notice that localhost is replaced by your domain name dynamically in handlebars. Do not touch the URLs. We have taken care of this substitution for you in step 3.3.6 Deploy
You must set the COUNTRY, LANGUAGES & AVAILABLE_LANGUAGES_SELECT values in the production file and can optionally set SENTRY & LOGROCKET VALUES.
Client app - local development: client-config.js
window.config = {
API_GATEWAY_URL: 'http://localhost:7070/',
CONFIG_API_URL: 'http://localhost:2021',
LOGIN_URL: 'http://localhost:3020',
AUTH_URL: 'http://localhost:4040',
COUNTRY_CONFIG_URL: 'http://localhost:3040',
COUNTRY: 'FAR',
AVAILABLE_LANGUAGES_SELECT: 'en:English,fr:Français',
LANGUAGES: 'en,fr',
SENTRY:
'https://f892d6[email protected]/1774604',
LOGROCKET: 'opencrvs-foundation/opencrvs-farajaland',
}
Following the same process as you did for the local development Login app config file, you must set the COUNTRY, LANGUAGES & AVAILABLE_LANGUAGES_SELECT values, and can optionally set SENTRY & LOGROCKET VALUES in the local development Client app config file.
Client app - production: client-config.prod.js
window.config = {
API_GATEWAY_URL: 'https://gateway.{{hostname}}/',
CONFIG_API_URL: 'https://config.{{hostname}}',
LOGIN_URL: 'https://login.{{hostname}}',
AUTH_URL: 'https://auth.{{hostname}}',
COUNTRY_CONFIG_URL: 'https://countryconfig.{{hostname}}',
COUNTRY: 'FAR',
AVAILABLE_LANGUAGES_SELECT: 'en:English,fr:Français',
LANGUAGES: 'en,fr',
SENTRY:
'https://[email protected]/1774604',
LOGROCKET: 'opencrvs-foundation/opencrvs-farajaland',
}
Following the same process as you did for the production Login app config file, you must set the COUNTRY, LANGUAGES & AVAILABLE_LANGUAGES_SELECT values, and can optionally set SENTRY & LOGROCKET VALUES in the production Client app config file.
You are now fully set up to run your own country configuration repo alongside OpenCRVS Core. You can start your country configuration server alongside a running OpenCRVS Core locally by following the instructions in step: 3.1.3 Starting & stopping OpenCRVS.
You can either move forward to step 4. Functional Configuration to configure a local environment, or alternatively proceed to step 3.3 Set-up a server hosted environment to publically host your OpenCRVS on a Development (staging) / QA or Production set of servers.