lib/legion/data/connection.rb in legion-data-1.1.2 vs lib/legion/data/connection.rb in legion-data-1.1.3
- old
+ new
@@ -27,14 +27,23 @@
def shutdown
@sequel&.disconnect
Legion::Settings[:data][:connected] = false
end
- def creds_builder
+ def creds_builder # rubocop:disable Metrics/AbcSize
final_creds = {}
- final_creds.merge! default_creds
+ final_creds.merge! Legion::Data::Settings.creds
final_creds.merge! Legion::Settings[:data][:creds] if Legion::Settings[:data][:creds].is_a? Hash
+
+ if Legion::Settings[:data][:connection][:max_connections].is_a? Integer
+ final_creds[:max_connections] = Legion::Settings[:data][:connection][:max_connections]
+ end
+
+ final_creds[:preconnect] = :concurrently if Legion::Settings[:data][:connection][:preconnect]
+
+ Legion::Logging.unknown final_creds
+
return final_creds if Legion::Settings[:vault].nil?
if Legion::Settings[:vault][:connected] && ::Vault.sys.mounts.key?(:database)
temp_vault_creds = Legion::Crypt.read('database/creds/legion')
final_creds[:user] = temp_vault_creds[:username]
@@ -49,11 +58,10 @@
host: '127.0.0.1',
port: 3306,
username: 'legion',
password: 'legion',
database: 'legion',
- max_connections: 32,
- preconnect: 'concurrently'
+ max_connections: 4
}
end
end
end
end