summaryrefslogtreecommitdiffstats
path: root/app.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app.rb')
-rw-r--r--app.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/app.rb b/app.rb
new file mode 100644
index 0000000..958f4b9
--- /dev/null
+++ b/app.rb
@@ -0,0 +1,19 @@
+require 'rubygems'
+require 'sinatra'
+require 'json/pure'
+get '/' do
+ res = "<html><body style=\"margin:0px auto; width:80%; font-family:monospace\">"
+ res << "<head><title>Environment</title><meta name=\"viewport\" content=\"width=device-width\"></head>"
+ res << "<h2>Environment</h2>"
+ res << "<div><table>"
+ ENV.keys.sort.each do |key|
+ res << "<tr><td><strong>#{key}</strong></td><td>#{ENV[key]}</tr>"
+ end
+ res << "</table></div>"
+ res << "<h2>HTTP Request Headers</h2>"
+ res << "<div><table>"
+ env.inject({}){|acc, (k,v)| acc[$1.downcase] = v if k =~ /^http_(.*)/i; acc}.sort.each do |k,v|
+ res << "<tr><td><strong>#{k}</strong></td><td>#{v}</tr>"
+ end
+ res << "</table></div></body></html>"
+end