@@ -8,7 +8,7 @@ import { execSync } from 'child_process';
8
8
import dedent from 'dedent' ;
9
9
import { promisify } from 'util' ;
10
10
import MongoBinaryDownload from './MongoBinaryDownload' ;
11
- import resolveConfig from './resolve-config' ;
11
+ import resolveConfig , { envToBool } from './resolve-config' ;
12
12
import debug from 'debug' ;
13
13
14
14
const log = debug ( 'MongoMS:MongoBinary' ) ;
@@ -27,6 +27,7 @@ export interface MongoBinaryOpts {
27
27
downloadDir ?: string ;
28
28
platform ?: string ;
29
29
arch ?: string ;
30
+ checkMD5 ?: boolean ;
30
31
}
31
32
32
33
export default class MongoBinary {
@@ -52,7 +53,7 @@ export default class MongoBinary {
52
53
}
53
54
54
55
static async getDownloadPath ( options : Required < MongoBinaryOpts > ) : Promise < string > {
55
- const { downloadDir, platform, arch, version } = options ;
56
+ const { downloadDir, platform, arch, version, checkMD5 } = options ;
56
57
// create downloadDir if not exists
57
58
await mkdirp ( downloadDir ) ;
58
59
@@ -82,6 +83,7 @@ export default class MongoBinary {
82
83
platform,
83
84
arch,
84
85
version,
86
+ checkMD5,
85
87
} ) ;
86
88
this . cache [ version ] = await downloader . getMongodPath ( ) ;
87
89
}
@@ -121,6 +123,7 @@ export default class MongoBinary {
121
123
arch : resolveConfig ( 'ARCH' ) || os . arch ( ) ,
122
124
version : resolveConfig ( 'VERSION' ) || LATEST_VERSION ,
123
125
systemBinary : resolveConfig ( 'SYSTEM_BINARY' ) ,
126
+ checkMD5 : envToBool ( resolveConfig ( 'MD5_CHECK' ) ?? '' ) ,
124
127
} ;
125
128
126
129
const options = { ...defaultOptions , ...opts } ;
0 commit comments