-
Notifications
You must be signed in to change notification settings - Fork 548
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Passing command line arguments to Node? #2563
Comments
I recommend using env vars to pass flags to node. For example: more info: |
Unfortunately, you can't pass
|
Ah, that sucks, well then I guess the only way forward is to use the Generic Language Support feature: https://www.phusionpassenger.com/docs/advanced_guides/gls/generic_guide.html |
As I mentioned in the issue, I tried that using |
You need to pass the port for your app to listen on in the start command. It must be passed this way because passenger chooses the port per-process. I don't see any way that you are doing that. |
I was able to get it working with It would be great if there was the ability to pass startup arguments directly through an option when in Apache or Nginx mode. |
Issue report
Question 1: What is the problem?
There doesn't seem to be a way to pass command-line arguments to node when invoked by Passenger.
Example: Since NodeJS v20.6.0, node supports an --env-file .env option. The .env file will be parsed into process.env. This reduces the need to depend on third-party modules like dotenv.
I can not find any configuration options to tell Passenger to use the
--env-file
argument when it invokes node.I tried using
PassengerAppStartCommand
set to/usr/local/bin/node --env-file /path/to/app/.env /path/to/app/index.js
. This launched the app, but not in the usual way. I couldcurl
is on its native port (3000), but apache was not serving the app on port 80.Question 2: Passenger version and integration mode:
Passenger 6.0.23, Apache httpd integration
Question 3: OS or Linux distro, platform (including version):
Red Hat Enterprise Linux release 9.4 (Plow)
Question 4: Passenger installation method:
Your answer:
Phusion YUM repo
Question 5: Your app's programming language (including any version managers) and framework (including versions):
NodeJS 20.17.0, Express 4.19.2
The text was updated successfully, but these errors were encountered: