Skip to content
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ variable. For detailed instructions for each of our supported platforms, please
--tlsCertificateSelector [arg] TLS Certificate in system store (Windows and macOS only)
--tlsCRLFile [arg] Specifies the .pem file that contains the Certificate Revocation List
--tlsDisabledProtocols [arg] Comma separated list of TLS protocols to disable [TLS1_0,TLS1_1,TLS1_2]
--tlsUseSystemCA Load the operating system trusted certificate list

API version options:

Expand Down
31 changes: 15 additions & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
"@typescript-eslint/parser": "^4.28.4",
"aws-sdk": "^2.674.0",
"axios": "^0.21.1",
"boxednode": "^1.10.5",
"boxednode": "^1.10.6",
"browserify": "^16.5.0",
"chai": "^4.2.0",
"command-exists": "^1.2.9",
Expand Down
4 changes: 4 additions & 0 deletions packages/build/src/compile/signable-compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ export class SignableCompiler {
path: await findModulePath('service-provider-server', 'os-dns-native'),
requireRegexp: /\bos_dns_native\.node$/
};
// Warning! Until https://jira.mongodb.org/browse/MONGOSH-990,
// packages/service-provider-server *also* has a copy of these.
// We use the versions included in packages/cli-repl here, so these
// should be kept in sync!
const winCAAddon = process.platform === 'win32' ? {
path: await findModulePath('cli-repl', 'win-export-certificate-and-key'),
requireRegexp: /\bwin_export_cert\.node$/
Expand Down
1 change: 1 addition & 0 deletions packages/cli-repl/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ CLI interface for [MongoDB Shell][mongosh], an extension to Node.js REPL with Mo
--tlsAllowInvalidCertificates Allow connections to servers with invalid certificates
--tlsCertificateSelector [arg] TLS Certificate in system store (Windows and macOS only)
--tlsDisabledProtocols [arg] Comma separated list of TLS protocols to disable [TLS1_0,TLS1_1,TLS1_2]
--tlsUseSystemCA Load the operating system trusted certificate list

API version options:

Expand Down
37 changes: 18 additions & 19 deletions packages/cli-repl/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/cli-repl/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@
"moment": "^2.29.1"
},
"optionalDependencies": {
"macos-export-certificate-and-key": "^1.0.2",
"win-export-certificate-and-key": "^1.0.4",
"macos-export-certificate-and-key": "^1.1.1",
"win-export-certificate-and-key": "^1.1.1",
"get-console-process-list": "^1.0.4"
}
}
7 changes: 4 additions & 3 deletions packages/cli-repl/src/arg-mapper.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CommonErrors, MongoshInvalidInputError, MongoshUnimplementedError } from '@mongosh/errors';
import { CliOptions, MongoClientOptions } from '@mongosh/service-provider-server';
import { CliOptions, DevtoolsConnectOptions } from '@mongosh/service-provider-server';
import setValue from 'lodash.set';

/**
Expand Down Expand Up @@ -29,6 +29,7 @@ const MAPPINGS = {
tlsCRLFile: 'sslCRL',
tlsCertificateKeyFile: 'tlsCertificateKeyFile',
tlsCertificateKeyFilePassword: 'tlsCertificateKeyFilePassword',
tlsUseSystemCA: 'useSystemCA',
username: 'auth.username',
verbose: { opt: 'loggerLevel', val: 'debug' }
};
Expand All @@ -45,8 +46,8 @@ function isExistingMappingKey(key: string, options: CliOptions): key is keyof ty
*
* @returns {} The driver options.
*/
function mapCliToDriver(options: CliOptions): MongoClientOptions {
const nodeOptions: MongoClientOptions = {};
function mapCliToDriver(options: CliOptions): DevtoolsConnectOptions {
const nodeOptions: DevtoolsConnectOptions = {};
for (const cliOption of Object.keys(MAPPINGS)) {
if (isExistingMappingKey(cliOption, options)) {
const mapping = MAPPINGS[cliOption as keyof typeof MAPPINGS];
Expand Down
1 change: 1 addition & 0 deletions packages/cli-repl/src/arg-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ const OPTIONS = {
'tlsAllowInvalidCertificates',
'tlsAllowInvalidHostnames',
'tlsFIPSMode',
'tlsUseSystemCA',
'verbose',
'version'
],
Expand Down
18 changes: 9 additions & 9 deletions packages/cli-repl/src/cli-repl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { MongoshInternalError, MongoshRuntimeError, MongoshWarning } from '@mong
import { redactURICredentials } from '@mongosh/history';
import i18n from '@mongosh/i18n';
import { bson, AutoEncryptionOptions } from '@mongosh/service-provider-core';
import { CliOptions, CliServiceProvider, MongoClientOptions } from '@mongosh/service-provider-server';
import { CliOptions, CliServiceProvider, DevtoolsConnectOptions } from '@mongosh/service-provider-server';
import { SnippetManager } from '@mongosh/snippet-manager';
import { Editor } from '@mongosh/editor';
import { redactSensitiveData } from '@mongosh/history';
Expand Down Expand Up @@ -159,10 +159,10 @@ class CliRepl implements MongoshIOProvider {
* information, external editor, and finally start the repl.
*
* @param {string} driverUri - The driver URI.
* @param {MongoClientOptions} driverOptions - The driver options.
* @param {DevtoolsConnectOptions} driverOptions - The driver options.
*/
// eslint-disable-next-line complexity
async start(driverUri: string, driverOptions: MongoClientOptions): Promise<void> {
async start(driverUri: string, driverOptions: DevtoolsConnectOptions): Promise<void> {
const { version } = require('../package.json');
await this.verifyNodeVersion();

Expand Down Expand Up @@ -451,9 +451,9 @@ class CliRepl implements MongoshIOProvider {
* Connect to the cluster.
*
* @param {string} driverUri - The driver URI.
* @param {MongoClientOptions} driverOptions - The driver options.
* @param {DevtoolsConnectOptions} driverOptions - The driver options.
*/
async connect(driverUri: string, driverOptions: MongoClientOptions): Promise<CliServiceProvider> {
async connect(driverUri: string, driverOptions: DevtoolsConnectOptions): Promise<CliServiceProvider> {
if (!this.cliOptions.nodb && !this.cliOptions.quiet) {
this.output.write(i18n.__(CONNECTING) + '\t\t' + this.clr(redactURICredentials(driverUri), 'mongosh:uri') + '\n');
}
Expand Down Expand Up @@ -523,11 +523,11 @@ class CliRepl implements MongoshIOProvider {
/**
* Is the password missing from the options?
*
* @param {MongoClientOptions} driverOptions - The driver options.
* @param {DevtoolsConnectOptions} driverOptions - The driver options.
*
* @returns {boolean} If the password is missing.
*/
isPasswordMissingOptions(driverOptions: MongoClientOptions): boolean {
isPasswordMissingOptions(driverOptions: DevtoolsConnectOptions): boolean {
return !!(
driverOptions.auth &&
driverOptions.auth.username &&
Expand Down Expand Up @@ -556,7 +556,7 @@ class CliRepl implements MongoshIOProvider {
* object is present with a truthy username. This is required by the driver, e.g.
* in the case of password-less Kerberos authentication.
*/
ensurePasswordFieldIsPresentInAuth(driverOptions: MongoClientOptions): void {
ensurePasswordFieldIsPresentInAuth(driverOptions: DevtoolsConnectOptions): void {
if (driverOptions.auth && driverOptions.auth.username && !('password' in driverOptions.auth)) {
driverOptions.auth.password = undefined;
}
Expand All @@ -566,7 +566,7 @@ class CliRepl implements MongoshIOProvider {
* Require the user to enter a password.
*
* @param {string} driverUrl - The driver URI.
* @param {MongoClientOptions} driverOptions - The driver options.
* @param {DevtoolsConnectOptions} driverOptions - The driver options.
*/
async requirePassword(): Promise<string> {
const passwordPromise = askpassword({
Expand Down
1 change: 1 addition & 0 deletions packages/cli-repl/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export const USAGE = `
--tlsCertificateSelector [arg] ${i18n.__('cli-repl.args.tlsCertificateSelector')}
--tlsCRLFile [arg] ${i18n.__('cli-repl.args.tlsCRLFile')}
--tlsDisabledProtocols [arg] ${i18n.__('cli-repl.args.tlsDisabledProtocols')}
--tlsUseSystemCA ${i18n.__('cli-repl.args.tlsUseSystemCA')}

${clr(i18n.__('cli-repl.args.apiVersionOptions'), 'mongosh:section-header')}

Expand Down
Loading