Skip to content

Commit 8b31ff5

Browse files
RodrigoTopannodkz
authored andcommitted
feat: add MONGOMS_DOWNLOAD_URL env variable for downloading binary from url
* refactor: 💡 download binary from the full address of mirror url MONGOMS DOWNLOAD_MIRROR environment variable should be able to install binaries from wherever users wants to .Without this refactor, this variable is used just to allow user to install binaries from another domain, but this is not considering the full path of binary * fix: 🐛 add the new env variable MONGOMS DOWNLOAD_MIRROR Add the new environment variable MONGOMS DOWNLOAD MIRROR to getDownloadUrl method to don't break anybody apps
1 parent 5089ec6 commit 8b31ff5

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ MONGOMS_PLATFORM=linux
118118
MONGOMS_ARCH=x64
119119
MONGOMS_VERSION=3
120120
MONGOMS_DEBUG=1 # also available case-insensitive values: "on" "yes" "true"
121-
MONGOMS_DOWNLOAD_MIRROR=url # your mirror url to download the mongodb binary
121+
MONGOMS_DOWNLOAD_MIRROR=host # your mirror host to download the mongodb binary
122+
MONGOMS_DOWNLOAD_URL=url # full URL to download the mongodb binary
122123
MONGOMS_DISABLE_POSTINSTALL=1 # if you want to skip download binaries on `npm i` command
123124
MONGOMS_SYSTEM_BINARY=/usr/local/bin/mongod # if you want to use an existing binary already on your system.
124125
MONGOMS_MD5_CHECK=1 # if you want to make MD5 check of downloaded binary.

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ export default class MongoBinaryDownloadUrl {
2424

2525
async getDownloadUrl(): Promise<string> {
2626
const archive = await this.getArchiveName();
27+
28+
const downloadUrl = resolveConfig('DOWNLOAD_URL');
29+
if (downloadUrl) return downloadUrl;
30+
2731
return `${resolveConfig('DOWNLOAD_MIRROR') || 'https://fastdl.mongodb.org'}/${
2832
this.platform
2933
}/${archive}`;

0 commit comments

Comments
 (0)