Skip to content

[BUG] ENV['APP_ENV'] isn't passed along to the server #3

@therobotreader

Description

@therobotreader

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

    rack (3.0.0.beta1)
    rackup (0.2.2)
      rack (>= 3.0.0.beta1)
      webrick
    webrick (1.7.0)

My config.ru is

run do |env|
  [200, {}, ["Hello World"]]
end

What I mean is, when I run APP_ENV=production rackup config.ru I get:

Rack::Handler is deprecated and replaced by Rackup::Handler
Puma starting in single mode...
* Puma version: 5.6.5 (ruby 3.0.1-p64) ("Birdie's Version")
*  Min threads: 0
*  Max threads: 5
*  Environment: development
*          PID: 561633
* Listening on http://127.0.0.1:9292
* Listening on http://[::1]:9292
Use Ctrl-C to stop

but when I run APP_ENV=production puma I get:

Puma starting in single mode...
* Puma version: 5.6.5 (ruby 3.0.1-p64) ("Birdie's Version")
*  Min threads: 0
*  Max threads: 5
*  Environment: production
*          PID: 561750
* Listening on http://0.0.0.0:9292
Use Ctrl-C to stop

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions