Check for necessary ENV variables in healthcheck
This commit is contained in:
parent
33240846b2
commit
31b19f3a2c
1 changed files with 10 additions and 3 deletions
|
|
@ -3,7 +3,7 @@
|
||||||
Healthcheck.configure do |config|
|
Healthcheck.configure do |config|
|
||||||
config.success = 200
|
config.success = 200
|
||||||
config.error = 503
|
config.error = 503
|
||||||
config.verbose = false
|
config.verbose = true
|
||||||
config.route = '/healthcheck'
|
config.route = '/healthcheck'
|
||||||
config.method = :get
|
config.method = :get
|
||||||
|
|
||||||
|
|
@ -14,8 +14,15 @@ Healthcheck.configure do |config|
|
||||||
# }
|
# }
|
||||||
|
|
||||||
# -- Checks --
|
# -- Checks --
|
||||||
# config.add_check :database, -> { ActiveRecord::Base.connection.execute('select 1') }
|
config.add_check :database, -> { ActiveRecord::Base.connection.execute('select 1') }
|
||||||
# config.add_check :migrations, -> { ActiveRecord::Migration.check_pending! }
|
config.add_check :migrations, -> { ActiveRecord::Migration.check_pending! }
|
||||||
# config.add_check :cache, -> { Rails.cache.read('some_key') }
|
# config.add_check :cache, -> { Rails.cache.read('some_key') }
|
||||||
# config.add_check :environments, -> { Dotenv.require_keys('ENV_NAME', 'ANOTHER_ENV') }
|
# config.add_check :environments, -> { Dotenv.require_keys('ENV_NAME', 'ANOTHER_ENV') }
|
||||||
|
config.add_check :env, -> {
|
||||||
|
keys = %W(SALSA_OAUTH_KEY SALSA_OAUTH_SECRET)
|
||||||
|
keys.each do |key|
|
||||||
|
puts "checking key"
|
||||||
|
raise "Env variable #{key} not set" unless ENV.key?(key)
|
||||||
|
end
|
||||||
|
}
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue