lib/tobox/configuration.rb in tobox-0.4.3 vs lib/tobox/configuration.rb in tobox-0.4.4
- old
+ new
@@ -14,10 +14,11 @@
DEFAULT_CONFIGURATION = {
environment: ENV.fetch("APP_ENV", "development"),
logger: nil,
log_level: nil,
database_uri: nil,
+ database_options: nil,
table: :outbox,
group_column: nil,
inbox_table: nil,
inbox_column: nil,
max_attempts: 10,
@@ -59,10 +60,10 @@
env = @config[:environment]
@default_logger = @config[:logger] || Logger.new(STDERR, formatter: DEFAULT_LOG_FORMATTER) # rubocop:disable Style/GlobalStdStream
@default_logger.level = @config[:log_level] || (env == "production" ? Logger::INFO : Logger::DEBUG)
@database = if @config[:database_uri]
- database_opts = {}
+ database_opts = @config[:database_options] || {}
database_opts[:max_connections] = @config[:concurrency] if @config[:worker] == :thread
db = Sequel.connect(@config[:database_uri].to_s, database_opts)
Array(@lifecycle_events[:database_connect]).each { |cb| cb.call(db) }
db
else