(POOLER-71) dummy auth only works in debug mode

If a user attempts to start vmpooler using dummy authentication
without setting the environment variable VMPOOLER_DEBUG, the vmpooler
will now refuse to start.
This commit is contained in:
Ryan McKern 2017-02-09 16:09:47 -08:00
parent 2c74f4fa3a
commit eb67ccad5a

View file

@ -32,6 +32,19 @@ module Vmpooler
parsed_config = YAML.load_file(config_file)
end
# Bail out if someone attempts to start vmpooler with dummy authentication
# without enbaling debug mode.
if parsed_config[:auth]['provider'] == 'dummy'
unless ENV['VMPOOLER_DEBUG']
warning = [
"Dummy authentication should not be used outside of debug mode",
"please set environment variable VMPOOLER_DEBUG to 'true' if you want to use dummy authentication",
]
raise warning.join(";\s")
end
end
# Set some configuration defaults
parsed_config[:redis] ||= {}
parsed_config[:redis]['server'] ||= 'localhost'