Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ gem 'bootsnap', '>= 1.4.2', require: false
gem 'bootstrap'
gem 'kaminari'
gem 'lograge', '>=0.11.2'
gem 'okcomputer', '~> 1.19'
gem 'omniauth-cas',
git: 'https://github.com/dlindahl/omniauth-cas.git',
ref: '7087bda829e14c0f7cab2aece5045ad7015669b1'
Expand Down
3 changes: 3 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,8 @@ GEM
oj (3.16.8)
bigdecimal (>= 3.0)
ostruct (>= 0.2)
okcomputer (1.19.1)
benchmark
omniauth (1.9.1)
hashie (>= 3.4.6)
rack (>= 1.6.2, < 3)
Expand Down Expand Up @@ -422,6 +424,7 @@ DEPENDENCIES
factory_bot_rails
kaminari
lograge (>= 0.11.2)
okcomputer (~> 1.19)
omniauth-cas!
paper_trail (~> 16.0)
pg
Expand Down
9 changes: 2 additions & 7 deletions app/controllers/home_controller.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
# TODO: split into HomeController & AdminController
class HomeController < ApplicationController
before_action(:logout_if_expired!, except: :health)
before_action(:require_admin!, except: :health)

def health
check = Health::Check.new
render json: check, status: check.http_status_code
end
before_action :logout_if_expired!
before_action :require_admin!

def admin_users
@active_users = User.active
Expand Down
37 changes: 0 additions & 37 deletions app/lib/health/check.rb

This file was deleted.

23 changes: 0 additions & 23 deletions app/lib/health/status.rb

This file was deleted.

7 changes: 7 additions & 0 deletions config/initializers/okcomputer.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Health check configuration

OkComputer.logger = Rails.logger
OkComputer.check_in_parallel = true

# Ensure database migrations have been run.
OkComputer::Registry.register 'database-migrations', OkComputer::ActiveRecordMigrationsCheck.new
2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

get '/home', to: 'forms#search_form'
get '/admin', to: 'home#admin'
get '/health', to: 'home#health'
get '/health', to: 'ok_computer/ok_computer#index', defaults: { format: :json }

# TODO: clean these all up

Expand Down
28 changes: 0 additions & 28 deletions spec/lib/health/status_spec.rb

This file was deleted.

18 changes: 18 additions & 0 deletions spec/request/okcomputer_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
require 'rails_helper'

RSpec.describe 'OKComputer', type: :request do
it 'is mounted at /okcomputer' do
get '/okcomputer'
expect(response).to have_http_status :ok
end

it 'returns all checks to /health' do
get '/health'
expect(response).to have_http_status :ok
expect(response.parsed_body.keys).to match_array %w[
default
database
database-migrations
]
end
end
10 changes: 0 additions & 10 deletions spec/system/home_system_spec.rb

This file was deleted.