lib/legion/settings/loader.rb in legion-settings-0.1.0 vs lib/legion/settings/loader.rb in legion-settings-0.1.1

- old
+ new

@@ -23,34 +23,38 @@ name: system_hostname, address: system_address } end - def default_settings + def default_settings # rubocop:disable Metrics/MethodLength default = { client: {}, legion: { - spawn: { + spawn: { limit: 12 - } + }, + extensions: {} }, transport: { rabbitmq: { user: 'guest', password: 'guest', host: '127.0.0.1' } }, data: { - mysql: { + mysql: { user: 'legion', password: 'legion', max_connections: 20, database: 'legion', host: '127.0.0.1', debug: false - } + }, + models: {}, + connection: {}, + migrations: { continue_on_fail: false } } } default[:client] = client_defaults if %w[client rspec].include?(legion_service_name) default end @@ -97,23 +101,23 @@ def load_env load_api_env end - def load_file(file) + def load_file(file) # rubocop:disable Metrics/AbcSize Legion::Logging.debug("Trying to load file #{file}") if File.file?(file) && File.readable?(file) begin contents = read_config_file(file) config = contents.empty? ? {} : Legion::JSON.load(contents) merged = deep_merge(@settings, config) deep_diff(@settings, merged) unless @loaded_files.empty? @settings = merged # @indifferent_access = false @loaded_files << file - rescue Legion::JSON::ParseError => error + rescue Legion::JSON::ParseError => e Legion::Logging.error('config file must be valid json') - Legion::Logging.debug("file:#{file}, error: #{error}") + Legion::Logging.debug("file:#{file}, error: #{e}") end else Legion::Logging.warn("Config file does not exist or is not readable file:#{file}") end end