简体   繁体   English

那么,如何从我的机架应用程序中删除 Rack::ShowExceptions 呢?

[英]So, how to remove Rack::ShowExceptions from inside my rack app?

I write own little http app based on rack.我基于机架编写了自己的小 http 应用程序。 And this code is to initialize rack.而这段代码是初始化机架。 (This is not sinatra, not rails, not hanami app). (这不是 sinatra,不是 rails,不是 hanami 应用程序)。

ENV['RACK_ENV']='deployment'
# some more initializations
# end then
@rack = Rack::Server.new(
    app: Router.new,
    Host: Cfg.http.host,
    Port: Cfg.http.port,
    Logger: Log,
    environment: Cfg.env.to_s
)

But if I crash my app I see in browser all that crap from Rack::ShowExceptions.但是如果我让我的应用程序崩溃,我会在浏览器中看到来自 Rack::ShowExceptions 的所有废话。

How can I completely disable, remove it, without need to patching rack sources?如何完全禁用、删除它,而不需要修补机架源?

@rack = Rack::Server.new(
    # ...
    environment: :none
)

I've open my eyes and found that in comments here https://github.com/rack/rack/blob/1.6.0/lib/rack/server.rb#L157-L162我睁开眼睛,发现这里的评论https://github.com/rack/rack/blob/1.6.0/lib/rack/server.rb#L157-L162

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM