Skip to content

Commit

Permalink
Set ssl_mode ssl toggle
Browse files Browse the repository at this point in the history
  • Loading branch information
ngetahun committed Dec 18, 2023
1 parent 8d4670d commit 5d08874
Showing 1 changed file with 18 additions and 13 deletions.
31 changes: 18 additions & 13 deletions lib/rmt/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,33 @@
File.join(__dir__, '../../config/rmt.local.yml')
)


module RMT::Config
class << self
def db_config(key = 'database')
def ssl_config(key = 'database')
{
'username' => Settings[key].username,
'password' => Settings[key].password,
'database' => Settings[key].database,
'host' => Settings[key].host || 'localhost',
'adapter' => Settings[key].adapter || 'mysql2',
'encoding' => Settings[key].encoding || 'utf8',
'timeout' => Settings[key].timeout || 5000,
'pool' => Settings[key].pool || 5,
'sslverify' => Settings[key].sslverify || false,
'sslverify' => Settings[key].sslverify || true,
'sslkey' => Settings[key].sslkey || '',
'sslcert' => Settings[key].sslcert || '',
'sslca' => Settings[key].sslca || '',
'sslcapath' => Settings[key].sslcapath || '',
'sslcipher' => Settings[key].sslcipher || ''
'sslcipher' => Settings[key].sslcipher || 'AES256-SHA',
'ssl_mode' => Settings[key].ssl_mode.try(:to_sym) || :disabled
}
end

def db_config(key = 'database')
{
'username' => Settings[key].username,
'password' => Settings[key].password,
'database' => Settings[key].database,
'host' => Settings[key].host || 'localhost',
'adapter' => Settings[key].adapter || 'mysql2',
'encoding' => Settings[key].encoding || 'utf8',
'timeout' => Settings[key].timeout || 5000,
'pool' => Settings[key].pool || 5
}.deep_merge! ssl_config
end

# This method checks whether or not deduplication should be done by hardlinks.
# If hardlinks are not used, the file will be copied instead.
def deduplication_by_hardlink?
Expand All @@ -53,7 +58,7 @@ def web_server
WebServerConfig.new(
max_threads: validate_int(Settings.try(:web_server).try(:max_threads)) || 5,
min_threads: validate_int(Settings.try(:web_server).try(:min_threads)) || 5,
workers: validate_int(Settings.try(:web_server).try(:workers)) || 2
workers: validate_int(Settings.try(:web_server).try(:workers)) || 2
)
end

Expand Down

0 comments on commit 5d08874

Please sign in to comment.