Skip to content

RUBY-3184 Rename crypt_shared_lib_required #2670

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/reference/client-side-encryption.txt
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ If the library can be loaded, then the driver will not try to spawn mongocryptd
The daemon will be still spawned if the shared library cannot be found.

It is also possible to require using the shared library by passing
``crypt_shared_lib_required: true`` option when creating a client. In this case,
``crypt_shared_required: true`` option when creating a client. In this case,
an error will be raised if the shared library cannot be loaded.

.. note::
Expand Down
2 changes: 1 addition & 1 deletion lib/mongo/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ def hash
# - :crypt_shared_lib_path => [ String | nil ] Path that should
# be the used to load the crypt shared library. Providing this option
# overrides default crypt shared library load paths for libmongocrypt.
# - :crypt_shared_lib_required => [ Boolean | nil ] Whether
# - :crypt_shared_required => [ Boolean | nil ] Whether
# crypt shared library is required. If 'true', an error will be raised
# if a crypt_shared library cannot be loaded by libmongocrypt.
#
Expand Down
8 changes: 4 additions & 4 deletions lib/mongo/crypt/auto_encrypter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class AutoEncrypter
# @option options [ String | nil ] :crypt_shared_lib_path Path that should
# be the used to load the crypt shared library. Providing this option
# overrides default crypt shared library load paths for libmongocrypt.
# @option options [ Boolean | nil ] :crypt_shared_lib_required Whether
# @option options [ Boolean | nil ] :crypt_shared_required Whether
# crypt shared library is required. If 'true', an error will be raised
# if a crypt_shared library cannot be loaded by libmongocrypt.
#
Expand All @@ -103,7 +103,7 @@ def initialize(options)
encrypted_fields_map: @options[:encrypted_fields_map],
bypass_query_analysis: @options[:bypass_query_analysis],
crypt_shared_lib_path: @options[:extra_options][:crypt_shared_lib_path],
crypt_shared_lib_required: @options[:extra_options][:crypt_shared_lib_required],
crypt_shared_required: @options[:extra_options][:crypt_shared_required],
)

@mongocryptd_options = @options[:extra_options].slice(
Expand All @@ -115,9 +115,9 @@ def initialize(options)
@mongocryptd_options[:mongocryptd_bypass_spawn] = @options[:bypass_auto_encryption] ||
@options[:extra_options][:mongocryptd_bypass_spawn] ||
@crypt_handle.crypt_shared_lib_available? ||
@options[:extra_options][:crypt_shared_lib_required]
@options[:extra_options][:crypt_shared_required]

unless @options[:extra_options][:crypt_shared_lib_required] || @crypt_handle.crypt_shared_lib_available?
unless @options[:extra_options][:crypt_shared_required] || @crypt_handle.crypt_shared_lib_available?
# Set server selection timeout to 1 to prevent the client waiting for a
# long timeout before spawning mongocryptd
@mongocryptd_client = Client.new(
Expand Down
6 changes: 3 additions & 3 deletions lib/mongo/crypt/handle.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class Handle
# @option options [ String | nil ] :crypt_shared_lib_path Path that should
# be the used to load the crypt shared library. Providing this option
# overrides default crypt shared library load paths for libmongocrypt.
# @option options [ Boolean | nil ] :crypt_shared_lib_required Whether
# @option options [ Boolean | nil ] :crypt_shared_required Whether
# crypt_shared library is required. If 'true', an error will be raised
# if a crypt_shared library cannot be loaded by libmongocrypt.
# @option options [ Boolean | nil ] :explicit_encryption_only Whether this
Expand Down Expand Up @@ -104,8 +104,8 @@ def initialize(kms_providers, kms_tls_options, options={})

initialize_mongocrypt

@crypt_shared_lib_required = !!options[:crypt_shared_lib_required]
if @crypt_shared_lib_required && crypt_shared_lib_version == 0
@crypt_shared_required = !!options[:crypt_shared_required]
if @crypt_shared_required && crypt_shared_lib_version == 0
raise Mongo::Error::CryptError.new(
"Crypt shared library is required, but cannot be loaded according to libmongocrypt"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def done!
let(:extra_options) do
{
crypt_shared_lib_path: SpecConfig.instance.crypt_shared_lib_path,
crypt_shared_lib_required: true,
crypt_shared_required: true,
mongocryptd_uri: mongocryptd_uri,
mongocryptd_spawn_args: [ "--pidfilepath=bypass-spawning-mongocryptd.pid", "--port=27777"]
}
Expand Down
8 changes: 4 additions & 4 deletions spec/mongo/crypt/handle_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
schema_map_path: schema_map_path,
bypass_query_analysis: bypass_query_analysis,
crypt_shared_lib_path: crypt_shared_lib_path,
crypt_shared_lib_required: crypt_shared_lib_required,
crypt_shared_required: crypt_shared_required,
explicit_encryption_only: explicit_encryption_only,
)
end
Expand All @@ -41,7 +41,7 @@
nil
end

let(:crypt_shared_lib_required) do
let(:crypt_shared_required) do
nil
end

Expand Down Expand Up @@ -118,11 +118,11 @@
end
end

context 'with crypt_shared_lib_required' do
context 'with crypt_shared_required' do
min_server_version '6.0.0'

context 'set to true' do
let(:crypt_shared_lib_required) do
let(:crypt_shared_required) do
true
end

Expand Down