Skip to content

Commit 4d2d36e

Browse files
committed
Validate supported adapters
1 parent a1c3ecc commit 4d2d36e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lib/departure/configuration.rb

+10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
module Departure
22
class Configuration
3+
SUPPORTED_ADAPTERS = %i[trilogy mysql2]
4+
35
attr_accessor :tmp_path, :global_percona_args, :enabled_by_default, :redirect_stderr, :adapter
46

57
def initialize
@@ -15,6 +17,14 @@ def error_log_path
1517
File.join(tmp_path, error_log_filename)
1618
end
1719

20+
def adapter=(name)
21+
if SUPPORTED_ADAPTERS.include?(name)
22+
@adapter = name
23+
else
24+
raise ArgumentError, "Supported Departure adapters are #{SUPPORTED_ADAPTERS.inspect}"
25+
end
26+
end
27+
1828
private
1929

2030
attr_reader :error_log_filename

0 commit comments

Comments
 (0)