lib/water_drop/schemas/config.rb in waterdrop-1.0.1 vs lib/water_drop/schemas/config.rb in waterdrop-1.2.0.beta1

- old
+ new

@@ -9,22 +9,12 @@ URI_SCHEMES = %w[ kafka kafka+ssl ].freeze - # All encryption related options keys - ENCRYPTION_OPTIONS_KEYS = %i[ - ssl_ca_cert - ssl_ca_cert_file_path - ssl_client_cert - ssl_client_cert_key - sasl_plain_authzid - sasl_plain_username - sasl_plain_password - sasl_gssapi_principal - sasl_gssapi_keytab - ].freeze + # Available sasl scram mechanism of authentication (plus nil) + SASL_SCRAM_MECHANISMS ||= %w[sha256 sha512].freeze configure do config.messages_file = File.join( WaterDrop.gem_root, 'config', 'errors.yml' ) @@ -41,17 +31,18 @@ end required(:client_id).filled(:str?, format?: Schemas::TOPIC_REGEXP) required(:logger).filled required(:deliver).filled(:bool?) + required(:raise_on_buffer_overflow).filled(:bool?) required(:kafka).schema do required(:seed_brokers).filled { each(:broker_schema?) } required(:connect_timeout).filled { (int? | float?) & gt?(0) } required(:socket_timeout).filled { (int? | float?) & gt?(0) } required(:compression_threshold).filled(:int?, gteq?: 1) - optional(:compression_codec).maybe(included_in?: %i[snappy gzip]) + optional(:compression_codec).maybe(included_in?: %i[snappy gzip lz4]) required(:max_buffer_bytesize).filled(:int?, gt?: 0) required(:max_buffer_size).filled(:int?, gt?: 0) required(:max_queue_size).filled(:int?, gt?: 0) @@ -61,12 +52,30 @@ required(:max_retries).filled(:int?, gteq?: 0) required(:retry_backoff).filled(:int?, gteq?: 0) required(:required_acks).filled(included_in?: [1, 0, -1, :all]) - ENCRYPTION_OPTIONS_KEYS.each do |encryption_attribute| + %i[ + ssl_ca_cert + ssl_ca_cert_file_path + ssl_client_cert + ssl_client_cert_key + sasl_gssapi_principal + sasl_gssapi_keytab + sasl_plain_authzid + sasl_plain_username + sasl_plain_password + sasl_scram_username + sasl_scram_password + ].each do |encryption_attribute| optional(encryption_attribute).maybe(:str?) end + + optional(:ssl_ca_certs_from_system).maybe(:bool?) + + # It's not with other encryptions as it has some more rules + optional(:sasl_scram_mechanism) + .maybe(:str?, included_in?: WaterDrop::Schemas::SASL_SCRAM_MECHANISMS) end end end end