ruby - 那么,如何从我的机架应用程序中删除 Rack::ShowExceptions 呢?
问题描述
我基于机架编写了自己的小型 http 应用程序。而这段代码是初始化机架。(这不是 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
)
但是如果我让我的应用程序崩溃,我会在浏览器中看到来自 Rack::ShowExceptions 的所有废话。
如何完全禁用、删除它,而不需要修补机架源?
解决方案
@rack = Rack::Server.new(
# ...
environment: :none
)
我睁开眼睛,发现这里的评论https://github.com/rack/rack/blob/1.6.0/lib/rack/server.rb#L157-L162
推荐阅读
- c++ - 创建一个 C++ 程序以查找给定整数数组中的整数对的数量,其总和等于指定数字
- uwp - 如何获取已安装的 nuget 包信息
- php - 为什么我的提交按钮不能将信息发送到我想要的电子邮件?(PHP)
- cordova - 应用程序和打开的窗口之间的通信
- php - 通过 PHP 生成 Excel 工作表 (CSV)
- typescript - 如何在新的命名空间下使用已经声明的类型?
- java - 在 Android 中使用 ContentProvider+Room 访问数据库的最佳实践是什么?
- netsuite - 如何在 NetSuite 中从 SOAP 请求中设置一个空的自定义国家/地区字段
- c# - 检查给定索引后集合中的所有内容是否为空的最简单方法是什么?
- python - 将 Pandas 系列转换为数据框