From 16ca40754277b6f9594967c786feefd253d1a56b Mon Sep 17 00:00:00 2001 From: Guillaume Lazzara Date: Wed, 1 Jun 2016 15:07:27 +0200 Subject: [PATCH] Add ping route --- app/controllers/ping_controller.rb | 11 +++++++++++ config/routes.rb | 2 ++ 2 files changed, 13 insertions(+) create mode 100644 app/controllers/ping_controller.rb diff --git a/app/controllers/ping_controller.rb b/app/controllers/ping_controller.rb new file mode 100644 index 000000000..8f5b11857 --- /dev/null +++ b/app/controllers/ping_controller.rb @@ -0,0 +1,11 @@ +class PingController < ApplicationController + + def index + if (ActiveRecord::Base.connected?) + render nothing: true, status: 200, content_type: "application/json" + else + render nothing: true, status: 500, content_type: "application/json" + end + end + +end diff --git a/config/routes.rb b/config/routes.rb index 37caf1f5a..81964b8d6 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,5 +1,7 @@ Rails.application.routes.draw do + get "/ping" => "ping#index", :constraints => {:ip => /127.0.0.1/} + devise_for :administrations, skip: [:password, :registrations] devise_for :administrateurs, controllers: {