Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有没有办法检测 Rails 应用程序是否在 Heroku 上运行?
我想做一个像这样的方法:
def on_heroku? ... end
您可以设置自己的配置变量以用于通过ENV['var'].
ENV['var']
$ heroku config:add I_AM_HEROKU=yes
def on_heroku? ENV['I_AM_HEROKU'] end
def heroku? ENV.any? {|x,_| x=~ /^HEROKU/ } end