Skip to content

Instantly share code, notes, and snippets.

@johndouthat
Created April 10, 2009 19:53
Show Gist options
  • Save johndouthat/93261 to your computer and use it in GitHub Desktop.
Save johndouthat/93261 to your computer and use it in GitHub Desktop.
<%
# This is the same as the stock _environment.rhtml, but with removal of some keys
# Keys that could contain sensitive data, like cc_number, and/or are redundant with _request.rhtml
request_parameters = %w{action_controller.request.request_parameters rack.request.form_hash rack.request.form_vars rack.routing_args}
# Keys that are generally not useful, since they just spit out standard inspections with class name and address
inspected = %w{action_controller.rescue.request action_controller.rescue.response rack.errors rack.input}
# includes the secret, which shouldn't be logged
others = %w{rack.session.options}
keys_to_reject = request_parameters + inspected + others
keys = @request.env.keys.sort.reject {|key| keys_to_reject.include?(key) }
max = keys.max { |a,b| a.length <=> b.length }
-%>
<% keys.each do |key| -%>
* <%= "%-*s: %s" % [max.length, key, filter_sensitive_post_data_from_env(key, @request.env[key].to_s.strip)] %>
<% end -%>
* Process: <%= $$ %>
* Server : <%= `hostname -s`.chomp %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment