Skip to content

Commit

Permalink
Validate supported adapters
Browse files Browse the repository at this point in the history
  • Loading branch information
xjunior committed Feb 8, 2024
1 parent c8d94f5 commit e877e6d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/departure/configuration.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
module Departure
class Configuration
SUPPORTED_ADAPTERS = %i[trilogy mysql2]

attr_accessor :tmp_path, :global_percona_args, :enabled_by_default, :redirect_stderr, :adapter

def initialize
Expand All @@ -15,6 +17,14 @@ def error_log_path
File.join(tmp_path, error_log_filename)
end

def adapter=(name)
if SUPPORTED_ADAPTERS.include?(name)
@adapter = name
else
raise ArgumentError, "Supported Departure adapters are #{SUPPORTED_ADAPTERS.inspect}"
end
end

private

attr_reader :error_log_filename
Expand Down

0 comments on commit e877e6d

Please sign in to comment.