Skip to content
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

Ability to customize which environment variables are used for HOST/PORT in Node adapter #1752

Closed
Conduitry opened this issue Jun 24, 2021 · 1 comment · Fixed by #1754
Closed
Labels

Comments

@Conduitry
Copy link
Member

Is your feature request related to a problem? Please describe.
In deployments at work, all of our environment variables are prefixed with unique identifiers indicating what service they are intended for. For SvelteKit apps using the Node adapter, this is impossible, as they have hardcoded into them special behavior for the HOST and PORT environment variables.

Describe the solution you'd like
Some configuration passed to the Node adapter function that lets you specify which environment variable names to use instead of HOST and PORT to determine at runtime what the server listens on.

Describe alternatives you've considered
I haven't tried putting e.g. process.env['PORT'] = process.env['FOO_PORT']; at the top of the hooks file, but I suspect that it will already be too late by then. If that doesn't work, I don't really have any other ideas besides using sed or something to hack the files after they're built.

How important is this feature to you?
This is going to depend on how upset the devops guy at work gets when I tell him he has to use the very generic HOST and PORT env vars for SvelteKit apps, as opposed to the specific prefixed env vars that every other service uses. I'm not clear on how environment variable configuration is getting handled, but this might actually create a conflict when another SvelteKit app needs to use different values.

Additional context
This was possible in Sapper because you could directly edit src/server.js to make it use the other environment variables instead.

@Conduitry Conduitry changed the title Ability to customize which headers are used for HOST/PORT in Node adapter Ability to customize which environment variables are used for HOST/PORT in Node adapter Jun 24, 2021
@dummdidumm
Copy link
Member

Since this is a adapter-specific thing and since this sounds like a simple config setting I don't see any harm in adding support for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants