Skip to content

Commit 6d091b6

Browse files
committed
fixed some redundancies, 500 error on missing env variable
1 parent db41d5f commit 6d091b6

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

app/controllers/health_controller.rb

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,11 @@ def index
1414
end
1515

1616
def gc
17-
verify_token_for_gc_stats
18-
19-
render json: JSON.pretty_generate([
17+
render body: JSON.pretty_generate([
2018
Time.now.in_time_zone("Central Time (US & Canada)").strftime("%H"),
2119
GC.stat
22-
])
20+
]),
21+
content_type: "application/json"
2322
end
2423

2524
def case_contacts_creation_times_in_last_week
@@ -81,6 +80,8 @@ def monthly_unique_users_graph_data
8180
private
8281

8382
def verify_token_for_gc_stats
84-
head :forbidden unless params[:token] == ENV.fetch("GC_ACCESS_TOKEN")
83+
gc_access_token = ENV["GC_ACCESS_TOKEN"]
84+
85+
head :forbidden unless params[:token] == gc_access_token && !gc_access_token.nil?
8586
end
8687
end

0 commit comments

Comments
 (0)