Skip to content

Commit 11c9547

Browse files
committed
fix(resolveConfig): change default version to be a constant (non-changeable)
1 parent 3a6b1b0 commit 11c9547

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

packages/mongodb-memory-server-core/src/util/DryMongoBinary.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import debug from 'debug';
2-
import { envToBool, resolveConfig, ResolveConfigVariables } from './resolveConfig';
2+
import { DEFAULT_VERSION, envToBool, resolveConfig, ResolveConfigVariables } from './resolveConfig';
33
import { checkBinaryPermissions, isNullOrUndefined, pathExists } from './utils';
44
import * as path from 'path';
55
import { arch, homedir, platform } from 'os';
@@ -96,7 +96,7 @@ export class DryMongoBinary {
9696
opts?: DryMongoBinaryOptions
9797
): Promise<Required<DryMongoBinaryOptions>> {
9898
log('generateOptions');
99-
const defaultVersion = resolveConfig(ResolveConfigVariables.VERSION) ?? '4.0.25';
99+
const defaultVersion = resolveConfig(ResolveConfigVariables.VERSION) ?? DEFAULT_VERSION;
100100
const ensuredOpts: DryMongoBinaryOptions = isNullOrUndefined(opts)
101101
? { version: defaultVersion }
102102
: opts;

packages/mongodb-memory-server-core/src/util/resolveConfig.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,11 @@ export enum ResolveConfigVariables {
2525
}
2626

2727
export const ENV_CONFIG_PREFIX = 'MONGOMS_';
28+
/** This Value exists here, because "defaultValues" can be changed with "setDefaultValue", but this property is constant */
29+
export const DEFAULT_VERSION = '4.0.25';
2830
export const defaultValues = new Map<ResolveConfigVariables, string>([
2931
// apply app-default values here
30-
[ResolveConfigVariables.VERSION, '4.0.25'],
32+
[ResolveConfigVariables.VERSION, DEFAULT_VERSION],
3133
[ResolveConfigVariables.PREFER_GLOBAL_PATH, 'true'],
3234
[ResolveConfigVariables.RUNTIME_DOWNLOAD, 'true'],
3335
[ResolveConfigVariables.USE_HTTP, 'false'],

0 commit comments

Comments
 (0)