59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
# File 'lib/hud.rb', line 59
def call(env)
status, , response = @app.call(env)
if ENV['HUD_SHOW_ENVIROMENT']
color = 'green'
color = 'orange' if ENV['HUD_ENV'] == "next"
color = 'red' if ENV['HUD_ENV'] == "live"
response_body = ''
response.each { |part| response_body << part }
indicator_div = "<div style='position:fixed; top:0; z-index:9999; height:30px; width:100%; background-color:#{color}; z-index:9999;'>#{ENV['HARBR_ENV']&.upcase} ENVIRONMENT</div>"
response_body.sub!("<body>", "<body>#{indicator_div}")
["Content-Length"] = response_body.bytesize.to_s
end
response = [response_body]
[status, , response]
end
|