question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

allow PORT configuration at app startup

See original GitHub issue

I’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:closed
  • Created 6 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
rallucommented, Sep 25, 2017

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.

0reactions
fulls1z3commented, Sep 26, 2017

@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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

To Allow Connection with Port Numbers in the Firewall Settings
To Allow Connection with Port Numbers in the Firewall Settings · For Windows 11. Select [Start] menu → [All apps] → [Control Panel]...
Read more >
How to: Enable the Net.TCP Port Sharing Service - WCF
To enable the manual start-up of the service, in the Properties window select the General tab, and in the Startup type box select...
Read more >
How to change the port number for Asp.Net core app?
public Startup(IConfiguration configuration, IHostingEnvironment env) { var builder ... Open LaunchSettings.json and change the Port Number.
Read more >
Opening a port on Linux | DigitalOcean
Within an operating system, a port allows the data packets specific processes or network services. Typically, ports identify a specific network ...
Read more >
Configure your network for MDM - Apple Support
Most MDM solutions accept inbound connections using HTTPS on port 443. Both the MDM solution and the devices must communicate with the Apple...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found