@@ -32,11 +32,11 @@ To install the optional dependencies, use pip with the ``encryption`` extra:
3232
3333 $ pip install django-mongodb-backend[encryption]
3434
35- Next, :ref: `download the shared library
35+ Next, download the :ref: `Automatic Encryption Shared Library
3636<manual:qe-csfle-shared-library-download>`. You can choose the latest version,
3737even if it doesn't match your MongoDB server version. After extracting the
38- shared library archive, :ref: `configure your Django settings
39- <qe-configuring-databases-setting>` with the path to the shared library .
38+ archive, configure the :ref: `crypt_shared_lib_path
39+ <qe-configuring-databases-setting>`.
4040
4141.. _qe-configuring-databases-setting :
4242
@@ -81,7 +81,7 @@ Here's a sample configuration using a local KMS provider::
8181 )
8282 },
8383 },
84- crypt_shared_lib_path="/path/to/mongo_crypt_shared_v1.dylib ",
84+ crypt_shared_lib_path="/path/to/mongo_crypt_shared_v1",
8585 crypt_shared_lib_required=True,
8686 )
8787 },
@@ -93,35 +93,65 @@ The database name of the key vault must be the same as in ``"NAME"``. The
9393vault's collection name can be whatever you wish, but by convention, it's often
9494``__keyVault ``.
9595
96-
9796.. admonition :: Dynamic library path configuration
9897
99- If you encounter ``Pymongocrypt.errors.MongoCryptError: An existing
100- crypt_shared library is loaded by the application at
101- [/path/to/mongo_crypt_v1.so], but the current call to mongocrypt_init()
102- failed to find that same library. ``, you may need to configure an
103- environment variable so that your system can locate the library:
98+ If you encounter the following error:
99+
100+ .. code-block :: text
101+
102+ Pymongocrypt.errors.MongoCryptError: An existing crypt_shared library is
103+ loaded by the application at [/path/to/mongo_crypt_v1.so], but the current
104+ call to mongocrypt_init() failed to find that same library.
105+
106+ add the directory that contains the shared library to your platform’s dynamic
107+ library search path:
108+
109+ +---------------+------------------------------+
110+ | **Platform ** | **Environment variable ** |
111+ +---------------+------------------------------+
112+ | Windows | PATH |
113+ +---------------+------------------------------+
114+ | macOS | DYLD_FALLBACK_LIBRARY_PATH |
115+ +---------------+------------------------------+
116+ | Linux | LD_LIBRARY_PATH |
117+ +---------------+------------------------------+
118+
119+ Examples:
120+
121+ macOS (bash):
122+
123+ .. code-block :: console
124+
125+ $ export DYLD_FALLBACK_LIBRARY_PATH="/path/to/mongo_crypt_shared:${DYLD_FALLBACK_LIBRARY_PATH}"
126+
127+ Linux (bash):
128+
129+ .. code-block :: console
130+
131+ $ export LD_LIBRARY_PATH="/path/to/mongo_crypt_shared:${LD_LIBRARY_PATH}"
132+
133+ Windows (PowerShell):
134+
135+ .. code-block :: powershell
136+
137+ $env: Path = " C:\path\to\mongo_crypt_shared" + " ;" + $env: Path
138+
139+ Windows (Command Prompt):
104140
105- +---------------+---------------------------------+
106- | **Platform ** | **Environment Variable ** |
107- +---------------+---------------------------------+
108- | Windows | ``PATH `` |
109- +---------------+---------------------------------+
110- | macOS | ``DYLD_FALLBACK_LIBRARY_PATH `` |
111- +---------------+---------------------------------+
112- | Linux | ``LD_LIBRARY_PATH `` |
113- +---------------+---------------------------------+
141+ .. code-block :: bat
114142
115- For example, on macOS you can set ``DYLD_FALLBACK_LIBRARY_PATH `` in your
116- shell before starting your Django application:
143+ set PATH = C:\path\to\mongo_crypt_shared;%PATH%
117144
118- .. code-block :: console
145+ Notes:
119146
120- $ export DYLD_FALLBACK_LIBRARY_PATH="/path/to/mongo_crypt_shared/:$DYLD_FALLBACK_LIBRARY_PATH"
147+ * Set the variable to the directory that contains the shared library file
148+ (for example, ``mongo_crypt_shared_v1.dylib `` on macOS,
149+ ``mongo_crypt_v1.so `` on Linux, or ``mongo_crypt_v1.dll `` on Windows), not
150+ the file itself.
121151
122- Unlike `` crypt_shared_lib_path `` earlier, the environment variable points
123- to the directory that contains the shared library, not the shared library
124- itself .
152+ * This environment variable is separate from the `` crypt_shared_lib_path ``
153+ option: the environment variable points to a directory, while
154+ `` crypt_shared_lib_path `` is the explicit path to the library file .
125155
126156.. _qe-configuring-database-routers-setting :
127157
0 commit comments