aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/health_checks_controller.rb16
-rw-r--r--app/helpers/health_checks_helper.rb8
-rw-r--r--app/views/health_checks/index.html.erb12
3 files changed, 36 insertions, 0 deletions
diff --git a/app/controllers/health_checks_controller.rb b/app/controllers/health_checks_controller.rb
new file mode 100644
index 000000000..473a1aacc
--- /dev/null
+++ b/app/controllers/health_checks_controller.rb
@@ -0,0 +1,16 @@
+class HealthChecksController < ApplicationController
+
+ def index
+ @health_checks = HealthChecks.all
+
+ respond_to do |format|
+ if HealthChecks.ok?
+ format.html { render :action => :index, :layout => false }
+ else
+ format.html { render :action => :index, :layout => false , :status => 500 }
+ end
+ end
+
+ end
+
+end
diff --git a/app/helpers/health_checks_helper.rb b/app/helpers/health_checks_helper.rb
new file mode 100644
index 000000000..f5769a9ba
--- /dev/null
+++ b/app/helpers/health_checks_helper.rb
@@ -0,0 +1,8 @@
+module HealthChecksHelper
+
+ def check_status(check)
+ style = check.ok? ? {} : "color: red"
+ content_tag(:b, check.message, :style => style)
+ end
+
+end
diff --git a/app/views/health_checks/index.html.erb b/app/views/health_checks/index.html.erb
new file mode 100644
index 000000000..67b1050a9
--- /dev/null
+++ b/app/views/health_checks/index.html.erb
@@ -0,0 +1,12 @@
+<h1>Health Checks</h1>
+
+<div class="checks">
+ <% @health_checks.each do |check| %>
+ <div class="check">
+ <ul>
+ <li>Message: <%= check_status(check) %></li>
+ <li>OK? <%= check.ok? %></li>
+ </ul>
+ </div>
+ <% end %>
+</div>