allow PORT configuration at app startup
See original GitHub issueI’m submitting a … (check one with “x”)
[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report <!-- Please check the repository for a similar issue or PR before submitting -->
[ ] Support request => <!-- Please check the repository for a similar issue or PR before submitting -->
[ ] Feature request
[x ] Documentation issue or request
Current behavior
Setting env variable PORT to a desired value prior to running npm run serve
has no impact on the app.
Expected/desired behavior
Setting PORT env variable before running npm run serve
configures the express server to listen on the specified port.
What is the motivation / use case for changing the behavior?
I am still a noob to webpack and angular 2 so I apologise if this is a dumb question. I am aware that setting the environment variable PORT at build time will bake the PORT into the app. Unfortunately, I only know which PORT to expose at app startup. This is a restriction imposed on me by my hosting platform, and I feel not an unreasonable one. I am pretty sure this is very possible, and probably quite a common use case, I just can’t find the appropriate docs and my experiments have yielded no fruit!
Environment
- Angular version: 4.4.1
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (2 by maintainers)
Top GitHub Comments
Having DefinePlugin in the project that has NodeJS server is a bad idea in my opinion. It prevents use cases like this (I had the same problem) and other cases where you need really to have system ENV variables for you.
I would suggest that ng-seed/universal would build their own env system totally separate from system ENV.
@Angry-Potato @rallu if you feel that an own env system totally separate from system ENV, you can always contribute with your use cases/ideas as well as PRs to this repo and angular-webpack-config.