* 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)
| 164 | * @throws MongoAPIError if TLS options are invalid |
| 165 | */ |
| 166 | function 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 | } |
| 176 | function getBoolean(name: string, value: unknown): boolean { |
| 177 | if (typeof value === 'boolean') return value; |
| 178 | switch (value) { |