Skip to content

Commit

Permalink
bailey's last few comments
Browse files Browse the repository at this point in the history
lint fix
  • Loading branch information
aditi-khare-mongoDB committed Mar 6, 2024
1 parent 2c59205 commit 9a2a74f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
13 changes: 5 additions & 8 deletions src/cmap/handshake/client_metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,18 +156,15 @@ export function makeClientMetadata(options: MakeClientMetadataOptions): ClientMe
return metadataDocument.toObject() as ClientMetadata;
}

let isDocker: boolean;
let dockerPromise: Promise<boolean>;
/** @internal */
async function getContainerMetadata() {
const containerMetadata: Record<string, any> = {};
if (isDocker == null) {
dockerPromise ??= fs.access('/.dockerenv').then(
() => true,
() => false
);
isDocker = await dockerPromise;
}
dockerPromise ??= fs.access('/.dockerenv').then(
() => true,
() => false
);
const isDocker = await dockerPromise;

const { KUBERNETES_SERVICE_HOST = '' } = process.env;
const isKubernetes = KUBERNETES_SERVICE_HOST.length > 0 ? true : false;
Expand Down
5 changes: 4 additions & 1 deletion src/connection_string.ts
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,10 @@ export function parseOptions(
);

mongoOptions.metadata = makeClientMetadata(mongoOptions);
mongoOptions.extendedMetadata = addContainerMetadata(mongoOptions.metadata);

mongoOptions.extendedMetadata = addContainerMetadata(mongoOptions.metadata).catch(() => {
/* rejections will be handled later */
});

return mongoOptions;
}
Expand Down

0 comments on commit 9a2a74f

Please sign in to comment.