-
Notifications
You must be signed in to change notification settings - Fork 10
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
[BUG] ENV['APP_ENV'] isn't passed along to the server #3
Comments
Sorry, I thought this issue was created on the Uh, so I don't have a strong opinion about it, but I've never liked Personally, I'd like to see us remove the handling of environments from rackup - I suspect what's happening here is that rackup is defaulting to I think for Rack 3.0 release, we should make a 1.0 release of this which replicates the existing Rackup behaviour, but then I'd be totally fine with us cutting loose on a Rackup 2.0 release with a bunch of improvements and a rethink of what we want to provide (option handling, etc). |
This does seem to be what's happening:
I think the current behavior is a bug, and I don't think you should preserve it in a 1.0 release. Puma expects the env to be something like production or development, not deployment. |
That seems reasonable to me, do you want to make a PR? |
Sure. Looking at the code, there doesn't seem to be one obvious place to do it. As far as I can tell, rackup is just passing all of its options to the handler, and counting on the handler to ignore whatever it doesn't need. I can see two possibilities:
What do you think is best? |
I think we should aim to remove RACK_ENV completely, so I think option (2) makes more sense. |
I took a reasonable stab at it, and it's turning into a bit of a game of whack-a-mole trying to sort through everything. I have a workaround for my problem by running puma instead of rackup, and I think when you get around to removing RACK_ENV that will fix this anyway, so I'm OK with closing this. |
Whatever I set ENV['APP_ENV'] to, when I run it with rackup directly, the server always starts in development mode. I would expect it to respect the env var, as it does when running it directly. This is on Ubuntu with ruby 3.0.1 and
My
config.ru
isWhat I mean is, when I run
APP_ENV=production rackup config.ru
I get:but when I run
APP_ENV=production puma
I get:with the environment set to production as expected.
Honestly, I'm not sure whether the bug is in rack, rackup, or puma. If there's a better location for this, let me know. Thanks!
The text was updated successfully, but these errors were encountered: