Skip to content

Resolve "Add Runtime Config to the App"

Andreas Pittrich requested to merge 904-add-runtime-config-to-the-app into main

Closes #904

This MR adds runtime configurations to the app, allowing various deployments of the same variant to be configured differently to some extend.

The configuration consists of a json file copied after deployment to /local/config.json

You can access this data with RccPublicRuntimeConfigService.get(...)

How to test?

In features.ts (of e.g. hcp) import ExampleRuntimeConfigModule. This will try to get data from the runtime config, if sucessful, logs it to the console. Since there is no config file, this should fail with an error telling you that it was unable to retrieve the value.

Before the error you should see an info message on the console that shows you an example config '>RuntimeConfiguration' (click to extend).

With Mocks/Exampledata

Next: import MockRccPublicRuntimeConfigModule. This will add data to RccPublicRuntimeConfigService directly not actually fetching data by http request. When included the error should disappear. Instead you should see an info message: 'Value for ExampleRuntimeConfigModule, "test.myFirstValue": my first mocked value'

With actual config file

  • Run yarn build:hcp.
  • Serve the app with yarn start:hcp:prebuilt
  • Open localhost:4201 in your browser. Observe the error from above.
  • Copy the example config from the console to /dist/app/hcp/local/config.json
  • Reload the app, the error should be gone. Instead an info message should report the success: 'Value for ExampleRuntimeConfigModule, "test.myFirstValue": [optional] string, My first test value meant for testing.'
Edited by Andreas Pittrich

Merge request reports

Loading