It is possible to define…
It is possible to define custom ENV variables or file in workspaces.json?
Responses:
We use environment.ts and environment.prod for managing environment variables. Is there a reason you don’t want to go that route?
I need more enviroments, something like: nx serve --env=qa
<http://environment.qa | environment.qa> ? |
yes, or test
, or dev
you should be able to achieve that with new environment.<env>.ts files and add different configurations to your workspace.json or angular.json file, maybe? that would work assuming your running a build per environment.
if you only want to run one build for every environment, I would suggest some sort of Valut, AWS SSM, Parameter Store type service to store those things, and get the values at startup
sorry, my brain is in backend land lately, is this for FE app or BE service?
It is a React app
What I have right now is several .env.{environment} files
Then npm scripts that run env-cmd -f .<http://env.qa|env.qa> nx serve
That works
gotcha, for our FE app we have a step in our deployment that gets some parameters out of aws and generates an env.js file and puts it in the bundle during deployment. The front end includes that file with a basic <script>
tag. all that is in the file is a couple window.{NAMESPACE_ENV_VAR} = 'blah';
an option I suppose