File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -8,10 +8,11 @@ const { localDataPath, configPath } = getLocalDataPath();
8
8
9
9
// If we decide to support non-string config options, we'll need to extend the mechanism for parsing
10
10
// env variables.
11
- interface UserConfig extends Record < string , string > {
11
+ interface UserConfig extends Record < string , string | undefined > {
12
12
apiBaseUrl : string ;
13
13
clientId : string ;
14
14
stateFile : string ;
15
+ connectionString ?: string ;
15
16
}
16
17
17
18
const defaults : UserConfig = {
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import { NodeDriverServiceProvider } from "@mongosh/service-provider-node-driver
4
4
import { DbOperationType , MongoDBToolBase } from "./mongodbTool.js" ;
5
5
import { ToolArgs } from "../tool.js" ;
6
6
import { ErrorCodes , MongoDBError } from "../../errors.js" ;
7
+ import config from "../../config.js" ;
7
8
8
9
export class ConnectTool extends MongoDBToolBase {
9
10
protected name = "connect" ;
@@ -20,7 +21,7 @@ export class ConnectTool extends MongoDBToolBase {
20
21
protected async execute ( {
21
22
connectionStringOrClusterName,
22
23
} : ToolArgs < typeof this . argsShape > ) : Promise < CallToolResult > {
23
- connectionStringOrClusterName ??= this . state . credentials . connectionString ;
24
+ connectionStringOrClusterName ??= config . connectionString || this . state . credentials . connectionString ;
24
25
if ( ! connectionStringOrClusterName ) {
25
26
return {
26
27
content : [
You can’t perform that action at this time.
0 commit comments