From 2d9222bb539356cc28ed63a7018317468aaa16c4 Mon Sep 17 00:00:00 2001 From: Rajesh Sharma Date: Fri, 29 Sep 2023 10:47:56 +0200 Subject: [PATCH] Fix config load for liveness probe Some rails apps might chose to not use the racecal.yml file. Let's load known config files if they are present similar to how cli handles them --- lib/racecar/ctl.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/racecar/ctl.rb b/lib/racecar/ctl.rb index fdb07c28..a45393b1 100644 --- a/lib/racecar/ctl.rb +++ b/lib/racecar/ctl.rb @@ -36,8 +36,10 @@ def liveness_probe(args) require "racecar/liveness_probe" parse_options!(args) - if ENV["RAILS_ENV"] - Racecar.config.load_file("config/racecar.yml", ENV["RAILS_ENV"]) + RailsConfigFileLoader.load! unless config.without_rails? + + if File.exist?("config/racecar.rb") + require "./config/racecar" end Racecar.config.liveness_probe.check_liveness_within_interval! @@ -136,5 +138,9 @@ def parse_options!(args) parser.parse!(args) end + + def config + Racecar.config + end end end