File tree Expand file tree Collapse file tree 2 files changed +16
-4
lines changed
packages/mongodb-runner/src Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,8 @@ import os from 'os';
44import path from 'path' ;
55import createDebug from 'debug' ;
66import * as utilities from './index' ;
7+ import { ConnectionString } from 'mongodb-connection-string-url' ;
8+ import { MongoClientOptions } from 'mongodb' ;
79
810( async function ( ) {
911 const defaultRunnerDir = path . join ( os . homedir ( ) , '.mongodb' , 'runner2' ) ;
@@ -101,9 +103,15 @@ import * as utilities from './index';
101103
102104 async function start ( ) {
103105 const { cluster, id } = await utilities . start ( argv , args ) ;
104- console . log ( `Server started and running at ${ cluster . connectionString } ` ) ;
106+ const cs = new ConnectionString ( cluster . connectionString ) ;
107+ console . log ( `Server started and running at ${ cs . toString ( ) } ` ) ;
105108 if ( cluster . oidcIssuer ) {
109+ cs . typedSearchParams < MongoClientOptions > ( ) . set (
110+ 'authMechanism' ,
111+ 'MONGODB-OIDC' ,
112+ ) ;
106113 console . log ( `OIDC provider started and running at ${ cluster . oidcIssuer } ` ) ;
114+ console . log ( `Server connection string with OIDC auth: ${ cs . toString ( ) } ` ) ;
107115 }
108116 console . log ( 'Run the following command to stop the instance:' ) ;
109117 console . log (
Original file line number Diff line number Diff line change @@ -82,9 +82,13 @@ export class MongoCluster {
8282 }
8383
8484 get connectionString ( ) : string {
85- return `mongodb://${ this . hostport } /${
86- this . replSetName ? `?replicaSet=${ this . replSetName } ` : ''
87- } `;
85+ const cs = new ConnectionString ( `mongodb://${ this . hostport } /` ) ;
86+ if ( this . replSetName )
87+ cs . typedSearchParams < MongoClientOptions > ( ) . set (
88+ 'replicaSet' ,
89+ this . replSetName ,
90+ ) ;
91+ return cs . toString ( ) ;
8892 }
8993
9094 get oidcIssuer ( ) : string | undefined {
You can’t perform that action at this time.
0 commit comments