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();
88
99// If we decide to support non-string config options, we'll need to extend the mechanism for parsing
1010// env variables.
11- interface UserConfig extends Record < string , string > {
11+ interface UserConfig extends Record < string , string | undefined > {
1212 apiBaseUrl : string ;
1313 clientId : string ;
1414 stateFile : string ;
15+ connectionString ?: string ;
1516}
1617
1718const defaults : UserConfig = {
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import { NodeDriverServiceProvider } from "@mongosh/service-provider-node-driver
44import { DbOperationType , MongoDBToolBase } from "./mongodbTool.js" ;
55import { ToolArgs } from "../tool.js" ;
66import { ErrorCodes , MongoDBError } from "../../errors.js" ;
7+ import config from "../../config.js" ;
78
89export class ConnectTool extends MongoDBToolBase {
910 protected name = "connect" ;
@@ -20,7 +21,7 @@ export class ConnectTool extends MongoDBToolBase {
2021 protected async execute ( {
2122 connectionStringOrClusterName,
2223 } : ToolArgs < typeof this . argsShape > ) : Promise < CallToolResult > {
23- connectionStringOrClusterName ??= this . state . credentials . connectionString ;
24+ connectionStringOrClusterName ??= config . connectionString || this . state . credentials . connectionString ;
2425 if ( ! connectionStringOrClusterName ) {
2526 return {
2627 content : [
You can’t perform that action at this time.
0 commit comments