How do I tell Sinatra what environment (development, test, production) it is?

此生再无相见时 提交于 2019-12-05 07:31:05

The Sinatra environment has nothing to do with the gems inside the production group being loaded. These are separate and don't work with each other.

Sinatra takes the environment from the RACK_ENV environment variable, just start it with RACK_ENV=production rackup

Bundler works a bit different, you can choose which groups it should exclude when running bundle install: bundle install --without production

Sinatra uses the APP_ENV environment variable. You can also set it explicitly via settings, as you mentioned.

A symbol specifying the deployment environment; typically set to one of :development, :test, or :production. The :environment defaults to the value of the APP_ENV environment variable (ENV['APP_ENV']), or :development when no APP_ENV environment variable is set.

That is how you tell Sinatra the environment.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!