MCPcopy
hub / github.com/mongodb/node-mongodb-native / checkTLSOptions

Function checkTLSOptions

src/connection_string.ts:166–175  ·  view source on GitHub ↗

* Checks if TLS options are valid * * @param allOptions - All options provided by user or included in default options map * @throws MongoAPIError if TLS options are invalid

(allOptions: CaseInsensitiveMap)

Source from the content-addressed store, hash-verified

164 * @throws MongoAPIError if TLS options are invalid
165 */
166function checkTLSOptions(allOptions: CaseInsensitiveMap): void {
167 if (!allOptions) return;
168 const check = (a: string, b: string) => {
169 if (allOptions.has(a) && allOptions.has(b)) {
170 throw new MongoAPIError(`The '${a}' option cannot be used with the '${b}' option`);
171 }
172 };
173 check('tlsInsecure', 'tlsAllowInvalidCertificates');
174 check('tlsInsecure', 'tlsAllowInvalidHostnames');
175}
176function getBoolean(name: string, value: unknown): boolean {
177 if (typeof value === 'boolean') return value;
178 switch (value) {

Callers 1

parseOptionsFunction · 0.85

Calls 1

checkFunction · 0.85

Tested by

no test coverage detected