You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Routing information is being placed in at develop time in the Angular api service files. This makes deployment involve app code changes. Here are the hardcoded values:
This has been a challenge to address up to now in API backed Angular front-ends (architecture diagram) that are built using the s2i built approach (build diagram), which creates a high performance web server image but at the cost of extra build complexity.
Solution
Here is a simple pattern from Eagle EPIC that solves this in a few lines, meeting the https://12factor.net Factor III, "Store config in the environment" and allowing the app to be deployed based on settings alone. It handles the more complicated s2i builds (other projects that expose environment settings in a similar pattern like MDS use a much simpler build process).
And remember to set your app to redeploy on environment variable change. That way your app will get new environment settings without needing a build.
Cheers!
PS. If you have a discrete admin site, the above solution uses the same pattern with slight variations on the path (/admin in the server build and image startup script but html stays the same). Note the use of uniquely named client-side variables to avoid collisions (public vs admin).
The text was updated successfully, but these errors were encountered:
Routing information is being placed in at develop time in the Angular api service files. This makes deployment involve app code changes. Here are the hardcoded values:
nrts-prc-public/src/app/services/api.ts
Line 76 in 90d75e2
Background
This has been a challenge to address up to now in API backed Angular front-ends (architecture diagram) that are built using the s2i built approach (build diagram), which creates a high performance web server image but at the cost of extra build complexity.
Solution
Here is a simple pattern from Eagle EPIC that solves this in a few lines, meeting the https://12factor.net Factor III, "Store config in the environment" and allowing the app to be deployed based on settings alone. It handles the more complicated s2i builds (other projects that expose environment settings in a similar pattern like MDS use a much simpler build process).
Please see the following areas of code:
You can check if your settings are exposed by (if you used the same pattern as above) visiting https://your-front-end-url/publicServerEnvironmentSettings.js
And remember to set your app to redeploy on environment variable change. That way your app will get new environment settings without needing a build.
Cheers!
PS. If you have a discrete admin site, the above solution uses the same pattern with slight variations on the path (/admin in the server build and image startup script but html stays the same). Note the use of uniquely named client-side variables to avoid collisions (public vs admin).
The text was updated successfully, but these errors were encountered: