You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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
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
andPORT
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
andPORT
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 usingsed
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
andPORT
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.The text was updated successfully, but these errors were encountered: