Sha256: 7d5e132192ee280cc3620d7e02b7583caa0450ace4866cfbdd5275fbe2247fe1
Contents?: true
Size: 1.98 KB
Versions: 5
Compression:
Stored size: 1.98 KB
Contents
require 'legion/settings' module Legion module Transport module Settings # Legion::Settings.merge_settings('transport', default) if Legion::Settings.method_defined? :merge_settings def self.connection { read_timeout: 1, heartbeat: 1, automatically_recover: true, continuation_timeout: 4000, network_recovery_interval: 1, connection_timeout: 1, user: 'guest', password: 'guest', host: '127.0.0.1', port: '5672', vhost: '/', recovery_attempts: 0, logger_level: 'info' }.merge(grab_vault_creds) end def self.grab_vault_creds return {} unless Legion::Settings[:crypt][:vault][:connected] lease = Legion::Crypt.read('rabbitmq/creds/legion', type: nil) Legion::Logging.debug 'successfully grabbed amqp username from Vault' { user: lease[:username], password: lease[:password] } rescue StandardError {} end def self.default { type: 'rabbitmq', connected: false, logger_level: 'info', messages: { encrypt: false, ttl: nil, priority: 0 }, exchanges: { type: 'topic', arguments: {}, auto_delete: false, durable: true, internal: false }, queues: { manual_ack: true, durable: true, exclusive: false, block: false, auto_delete: false, arguments: { 'x-max-priority': 255, 'x-overflow': 'reject-publish' } }, prefetch: 2, connection: connection } end end end end begin Legion::Settings.merge_settings('transport', Legion::Transport::Settings.default) if Legion.const_defined?('Settings') rescue StandardError => e Legion::Logging.fatal(e.message) if Legion::Logging.method_defined?(:fatal) end
Version data entries
5 entries across 5 versions & 2 rubygems