Skip to content

Commit e826566

Browse files
ChronicusUAnodkz
authored andcommitted
feat: add MONGOMS_DISABLE_POSTINSTALL env variable for disabling binary download on package install
* fix: Remove latest verion from postinstall.js (#84) * feat: add MONGOMS_DOWNLOAD_ON_POSTINSTALL env variable * fix: rename disable postinstall env vriable (#84)
1 parent b191c94 commit e826566

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ MONGOMS_ARCH=x64
7676
MONGOMS_VERSION=3
7777
MONGOMS_DEBUG=1 # also available case-insensitive values: "on" "yes" "true"
7878
MONGOMS_DOWNLOAD_MIRROR=url # your mirror url to download the mongodb binary
79+
MONGOMS_DISABLE_POSTINSTALL=1 # if you want to skip download binaries on `npm i` command
7980
```
8081
8182
### Replica Set start:

postinstall.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,15 @@ function isModuleExists(name) {
1313
catch(e) { return false }
1414
}
1515

16+
const skipDownload = typeof process.env.MONGOMS_DISABLE_POSTINSTALL === 'string'
17+
? ['1', 'on', 'yes', 'true'].indexOf(process.env.MONGOMS_DISABLE_POSTINSTALL.toLowerCase()) !== -1
18+
: false;
19+
20+
if (skipDownload) {
21+
console.log("Download is skipped by MONGOMS_DISABLE_POSTINSTALL variable");
22+
process.exit(0);
23+
}
24+
1625
if (isModuleExists('./lib/util/MongoBinary')) {
1726
const MongoBinary = require('./lib/util/MongoBinary').default;
1827

0 commit comments

Comments
 (0)