This is not an issue more of a question at the moment. I have an application I am developing that communicates with a REST service, so the application makes use of config for the apiEndpoint.
My problem is that that I would like to build (I use Bamboo for automated builds) the application and the installer and then publish to different environments and this is where I have got stuck.
What I would like is for the installer to set an environment variable so when the application runs it will have this environment variable set and will then use the correct configuration file and pickup the correct apiEndpoint
config/
default.json
default.[int].json
default.[staging].json
//etc.
the above represents the config files and the text in the square brackets the environment variable so when the user runs the application executable then the equivalent of set NODE_ENV=int
and the application runs up and uses default.int.json
as the configuration file.
So, is this even possible from the MSI or could someone please suggest an alternative way to achieve this without having to build an MSI for each environment.
NOTE: This application will only be supported on Windows if that makes things easier
You can read system envs on Windows. What's problem to read it? You don't want to force users to set such env, right?
How does the installer know which value he has to set? Have you already checked your favourite search eninge? (http://lmgtfy.com/?q=msi+set+env)
Is possible to load dynamic the config.{env}.json file without rebuild the app?