-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Handle blank environment variables when loading config #3539
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
Conversation
I see how this is useful but I'm a tiny bit worried that this may hide the configuration errors from the user. Maybe this should be part of Puma v7. |
I think I'd expect this to work like It'll fall back to Not from puma's internals, but I found a bug in a I wonder if I might be slightly special in how I use the shell, but having run into this with both a crappy config file of my own making, and natively with Puma 6 and the internals exploding I figured I'd raise the PR. The case where it's overridden in one command locally for testing purposes was where our app specifies Also (tongue in cheek 😛) if you squint in the right way, this is a regression in behaviour. Puma 4 runs fine, then Puma 5 blows up.
Mostly I think it should behave the same as |
76958ce
to
620291a
Compare
Fixed the jruby tests and corrected the first commit to say "max", not "min". |
620291a
to
ff24f09
Compare
I did not know that – then I agree, this sounds more like a bug fix |
This mirrors the test above for min threads, creating a configuration instance wasn't checking anything here previously
Sometimes (usually for overriding values temporarily) shells can unset environment variables by setting them to a blank value, ruby interprets this as an empty string. Doing so with Puma's default environment parsing would previously blow up because `Integer("")` is not valid. $ WEB_CONCURRENCY= bundle exec puma bundler: failed to load command: puma (/Users/caius/.asdf/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/bin/puma) <internal:kernel>:307:in `Integer': invalid value for Integer(): "" (ArgumentError) Add tests for `WEB_CONCURRENCY`, `PUMA_MIN_THREADS` and `PUMA_MAX_THREADS` and then check we're not trying to parse a blank value before doing so.
ff24f09
to
f12933f
Compare
This conflicted with #3550. Rebased and fixed the merge issues. |
Description
Sometimes (usually for overriding values temporarily) shells can unset environment variables by setting them to a blank value, ruby interprets this as an empty string. Doing so with Puma's default environment parsing would previously blow up because
Integer("")
is not valid.WEB_CONCURRENCY
,PUMA_MIN_THREADS
andPUMA_MAX_THREADS
being""
PUMA_MAX_THREADS
to matchPUMA_MIN_THREADS
testYour checklist for this pull request
[ci skip]
to the title of the PR.#issue
" to the PR description or my commit messages.