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

Skip optional workers based on port number #26

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jwatzman
Copy link

@jwatzman jwatzman commented Oct 12, 2024

The optional workers in #24 doesn't quite work right: because env variables are always strings, generate-dotenv.cjs will set these two new env vars to the string 'false' -- which is truthy. So the console and admin workers will always be deactivated unless we set the value to the string '' or similar, which is confusing for these boolean-sounding settings.

Instead, we can just check if the port number is set, and skip if not, which is nice that we don't need a new env var -- you can just set the port number to the empty string to deactivate. This does have a similar issue, in that if you set the port to '0', it will still try to activate the optional worker -- but parseListenPort will immediately yell that 0 is an invalid port so at least you know immediately.

The optional workers in getcord#24 doesn't quite work right: because env
variables are always strings, `generate-dotenv.cjs` will set these two
new env vars to the string `'false'` -- which is truthy. So the console
and admin workers will always be deactivated unless we set the value to
the string `''` or similar, which is confusing for these
boolean-sounding settings.

Instead, we can just check if the port number is set, and skip if not,
which is nice that we don't need a new env var -- you can just set the
port number to the empty string to deactivate.  This does have a similar
issue, in that if you set the port to `0'`, it will still try to
activate the optional worker -- but `parseListenPort` will immediately
yell that `0` is an invalid port so at least you know immediately.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants