Skip to content

Commit 621c44e

Browse files
committed
Code review fixes (5/x)
- Configuring the Automatic Encryption Shared Library
1 parent cd035eb commit 621c44e

File tree

1 file changed

+34
-2
lines changed

1 file changed

+34
-2
lines changed

docs/source/howto/queryable-encryption.rst

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,40 @@ If you do not want to use the data keys created by Django MongoDB Backend (when
204204
In this scenario, Django MongoDB Backend will use the newly created data keys
205205
to create collections for models with encrypted fields.
206206

207-
Configuring the Crypt Shared Library
208-
====================================
207+
Configuring the Automatic Encryption Shared Library
208+
===================================================
209+
210+
The :ref:`manual:qe-reference-shared-library` is a preferred alternative to
211+
:ref:`manual:qe-mongocryptd` and does not require you to start another process
212+
to perform automatic encryption.
213+
214+
In practice, if you use Atlas or Enterprise MongoDB, ``mongocryptd`` is already
215+
configured for you, however in such cases the shared library is still
216+
recommended for use with Queryable Encryption.
217+
218+
You can :ref:`download the shared library
219+
<manual:qe-csfle-shared-library-download>` from the
220+
:ref:`manual:enterprise-official-packages` and configure it in your Django
221+
settings as follows:
222+
223+
.. code-block:: python
224+
225+
from django_mongodb_backend import parse_uri
226+
from pymongo.encryption_options import AutoEncryptionOpts
227+
228+
DATABASES = {
229+
"encrypted": parse_uri(
230+
DATABASE_URL,
231+
options={
232+
"auto_encryption_opts": AutoEncryptionOpts(
233+
key_vault_namespace="keyvault.keyvault",
234+
kms_providers={"local": {"key": os.urandom(96)}},
235+
crypt_shared_lib_path="/path/to/mongo_crypt_shared_v1.dylib",
236+
)
237+
},
238+
db_name="encrypted",
239+
),
240+
}
209241
210242
You are now ready to :doc:`develop with Queryable Encryption
211243
</topics/queryable-encryption>` in Django MongoDB Backend!

0 commit comments

Comments
 (0)