From e877e6d743eb976fbd0c3a6d6949f7c9acff9f5c Mon Sep 17 00:00:00 2001 From: Carlos Palhares Date: Thu, 8 Feb 2024 12:17:57 -0300 Subject: [PATCH] Validate supported adapters --- lib/departure/configuration.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/departure/configuration.rb b/lib/departure/configuration.rb index 34e48cb9..4f19cfe2 100644 --- a/lib/departure/configuration.rb +++ b/lib/departure/configuration.rb @@ -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 @@ -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