0

I'm trying to figure out how to make a configurable config file in angular, enable me to change its variables values after build to staging or prod. I created an application.config.ts in the assets folder, knowing that the assets folder is not being minified and copied as is. There is a component in the app that reads that variable value straight from the config file. After building the app in staging or prod configuration, when I change one of the variables value in that file (stop IIS, change it and restart the IIS)- it is not changed in the application component. What should I do in order to make it editable in the staging\prod env. ?

Guy E
  • 1,775
  • 2
  • 27
  • 55
  • Couldn't you just use different builds based on different configs in the _angular.json_? – DonJuwe Feb 10 '21 at 09:17
  • Load it on app start as an external file (like calling API - using http request) to get its fresh content – Benny Halperin Feb 10 '21 at 09:46
  • @DonJuwe - What do you mean ? I'm using a different builds - but still - I would like to change the variables after deploying, no matter to what environment - doing a config change without the need to re-deploy\build – Guy E Feb 10 '21 at 09:48
  • @Benny - this is a solution, but I thought of a simpler solution using some kind of static file – Guy E Feb 10 '21 at 09:50
  • @GuyE IMHO this is a simple and true data-driven configuration. Configuration should not be compiled. Only default configuration (fallback) – Benny Halperin Feb 10 '21 at 09:51

0 Answers0