-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Makes Node adapter respect HOST (#1365) #1366
Conversation
By default, the HOST variable is set to 127.0.0.1, for safety.
Thank you — is there a reason to default to |
My typical workflow is to use a local nginx instance to reverse proxy requests to Node (to simplify SSL setup, among things), so I set the default assuming that use case. Since this is for production servers, I've modifed the default to be |
Thank you — I took the liberty of adding a changeset and docs |
packages/adapter-node/src/index.js
Outdated
@@ -2,9 +2,9 @@ import { createServer } from './server'; | |||
/*eslint import/no-unresolved: [2, { ignore: ['\.\/app\.js$'] }]*/ | |||
import * as app from './app.js'; | |||
|
|||
const { PORT = 3000 } = process.env; // TODO configure via svelte.config.js | |||
const { HOST = '0.0.0.0', PORT = 3000 } = process.env; // TODO configure via svelte.config.js |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this TODO still a TODO? Would the env vars take precedence?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's still a TODO insofar as you can't specify a default port/host via the adapter config. Is that something worth having, if we have environment variables?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well yeah what I meant is: is this something we still want to do? I don't have especially strong opinions about that. I assume it would be additional args you pass to the adapter factory function and not somewhere else in the config.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it would be, yeah. tbh i'm inclined to just remove the TODO comment — it's less confusing if there's only one way to set non-default values, and we need environment variables regardless so that it's configurable at runtime
By default, the HOST variable is set to 127.0.0.1, for safety.
I lack the experience to set up a test runnable via
pnpm test
, but I've tested this as follows:npm run build
HOST=192.168.1.64 npm start
npm run build
HOST=192.168.1.64 npm start
Before submitting the PR, please make sure you do the following
Tests
pnpm test
and lint the project withpnpm lint
Changesets
pnpx changeset
and following the prompts