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
Development 404 page still shows up when using -e production
command-line flag
#1544
Comments
How do you think this problem should be solved? |
Good question, I tried a couple options and realized it isn’t as easy to fix as I hoped. The issue is that classical apps extend Application which extends Base (where the configurations are originally made). So supporting both classic and modular style apps becomes tricky. If anyone has any ideas please chime in 🙂 |
Hmmm, what if we didn’t offer the command-line flag? It’s awkward that we have two ways of accomplishing the same thing, and it’s difficult to tell which should be preferred (the environment variable, it seems). |
That sounds like a valid option to me. I put together a PR #1547 for another possible solution. |
Fix issue setting environment from command line option Fixes #1544
Let
server.rb
be simplyNow run it with
$ ruby server.rb -e production
Sinatra will say that it’s running in production mode:
== Sinatra (v2.0.5) has taken the stage on 4567 for production with backup from Thin
But visit http://localhost:4567 and you’ll see the development 404 page:
I tried this with both WEBrick and Thin.
Of course, the problem goes away when using the
APP_ENV
environment variable:$ env APP_ENV=production ruby server.rb
The text was updated successfully, but these errors were encountered: