Merge branch '8784-dir-listings'
[arvados.git] / services / api / lib / tasks / config_check.rake
1 # Copyright (C) The Arvados Authors. All rights reserved.
2 #
3 # SPDX-License-Identifier: AGPL-3.0
4
5 namespace :config do
6   desc 'Ensure site configuration has all required settings'
7   task check: :environment do
8     $stderr.puts "%-32s %s" % ["AppVersion (discovered)", AppVersion.hash]
9     $application_config.sort.each do |k, v|
10       if ENV.has_key?('QUIET') then
11         # Make sure we still check for the variable to exist
12         eval("Rails.configuration.#{k}")
13       else
14         if /(password|secret|signing_key)/.match(k) then
15           # Make sure we still check for the variable to exist, but don't print the value
16           eval("Rails.configuration.#{k}")
17           $stderr.puts "%-32s %s" % [k, '*********']
18         else
19           $stderr.puts "%-32s %s" % [k, eval("Rails.configuration.#{k}")]
20         end
21       end
22     end
23     # default_trash_lifetime cannot be less than 24 hours
24     if Rails.configuration.default_trash_lifetime < 86400 then
25       raise "default_trash_lifetime is %d, must be at least 86400" % Rails.configuration.default_trash_lifetime
26     end
27   end
28 end