Skip to content

Commit

Permalink
ISSUE #5412 support dotenv to inject environment variables
Browse files Browse the repository at this point in the history
  • Loading branch information
carmenfan committed Mar 3, 2025
1 parent 77164cc commit fe2add9
Show file tree
Hide file tree
Showing 2 changed files with 99 additions and 14 deletions.
25 changes: 13 additions & 12 deletions backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,23 @@
"gen-docs": "yarn apidoc -i src/v4/routes/ -o docs/ ",
"test": "yarn test:unit && yarn test:int",
"test:v5": "yarn test:v5-drivers && yarn test:v5-unit && yarn test:v5-e2e && yarn test:v5-scripts",
"test:v5-unit": "cross-env NODE_ENV=testV5 NODE_CONFIG_DIR=../config yarn jest -c ./jest.config.unit.js",
"test:v5-e2e": "cross-env NODE_ENV=testV5 NODE_CONFIG_DIR=../config yarn jest -c ./jest.config.e2e.js --runInBand",
"test:v5-drivers": "cross-env NODE_ENV=testV5 NODE_CONFIG_DIR=../config yarn jest -c ./jest.config.drivers.js --runInBand",
"test:v5-scripts": "cross-env NODE_ENV=testV5 NODE_CONFIG_DIR=../config yarn jest -c ./jest.config.scripts.js --runInBand",
"test:unit": "cross-env NODE_ENV=test NODE_CONFIG_DIR=../config mocha tests/v4/unit --recursive --exit",
"test:one": "cross-env NODE_ENV=test NODE_CONFIG_DIR=../config mocha --exit",
"test:int": "cross-env NODE_ENV=test NODE_CONFIG_DIR=../config mocha tests/v4/integrated --recursive --exit",
"test:v5-unit": "cross-env NODE_ENV=testV5 NODE_CONFIG_DIR=../config dotenvx run -f ../config/%NODE_ENV%/.env -- yarn jest -c ./jest.config.unit.js",
"test:v5-e2e": "cross-env NODE_ENV=testV5 NODE_CONFIG_DIR=../config dotenvx run -f ../config/%NODE_ENV%/.env -- yarn jest -c ./jest.config.e2e.js --runInBand",
"test:v5-drivers": "cross-env NODE_ENV=testV5 NODE_CONFIG_DIR=../config dotenvx run -f ../config/%NODE_ENV%/.env -- yarn jest -c ./jest.config.drivers.js --runInBand",
"test:v5-scripts": "cross-env NODE_ENV=testV5 NODE_CONFIG_DIR=../config dotenvx run -f ../config/%NODE_ENV%/.env -- yarn jest -c ./jest.config.scripts.js --runInBand",
"test:unit": "cross-env NODE_ENV=test NODE_CONFIG_DIR=../config dotenvx run -f ../config/%NODE_ENV%/.env -- mocha tests/v4/unit --recursive --exit",
"test:one": "cross-env NODE_ENV=test NODE_CONFIG_DIR=../config dotenvx run -f ../config/%NODE_ENV%/.env -- mocha --exit",
"test:int": "cross-env NODE_ENV=test NODE_CONFIG_DIR=../config dotenvx run -f ../config/%NODE_ENV%/.env -- mocha tests/v4/integrated --recursive --exit",
"lint": "eslint . --rulesdir eslint-rules/",
"lint:fix": "yarn lint --fix",
"start": "cross-env NODE_CONFIG_DIR=../config node ./src/v4/3drepo.js",
"watch": "cross-env NODE_CONFIG_DIR=../config nodemon ./src/v4/3drepo.js",
"run-migration": "cross-env NODE_CONFIG_DIR=../config node ./src/scripts/migrations/index",
"run-script": "cross-env NODE_CONFIG_DIR=../config node ./src/scripts/utility/index",
"run-scheduled-tasks": "cross-env NODE_CONFIG_DIR=../config node ./src/scripts/utility/scheduler"
"start": "cross-env NODE_CONFIG_DIR=../config dotenvx run -f ../config/%NODE_ENV%/.env -- node ./src/v4/3drepo.js",
"watch": "cross-env NODE_CONFIG_DIR=../config dotenvx run -f ../config/%NODE_ENV%/.env -- nodemon ./src/v4/3drepo.js",
"run-migration": "cross-env NODE_CONFIG_DIR=../config dotenvx run -f ../config/%NODE_ENV%/.env -- node ./src/scripts/migrations/index",
"run-script": "cross-env NODE_CONFIG_DIR=../config dotenvx run -f ../config/%NODE_ENV%/.env -- node ./src/scripts/utility/index",
"run-scheduled-tasks": "cross-env NODE_CONFIG_DIR=../config dotenvx run -f ../config/%NODE_ENV%/.env -- node ./src/scripts/utility/scheduler"
},
"dependencies": {
"@dotenvx/dotenvx": "1.38.3",
"@elastic/elasticsearch": "7.17.14",
"@frontegg/client": "5.3.2",
"amqplib": "0.10.5",
Expand Down
88 changes: 86 additions & 2 deletions backend/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,26 @@
enabled "2.0.x"
kuler "^2.0.0"

"@dotenvx/[email protected]":
version "1.38.3"
resolved "https://registry.yarnpkg.com/@dotenvx/dotenvx/-/dotenvx-1.38.3.tgz#e78afdc3e96f13537db75def376dc7a8558f042b"
integrity sha512-6tquYDfAiJbgQbYwWfL0jJHiUumY5EiFXVswk9sTwn5lWICMwOPmMOrM9TEVLzesfNMYwDyUiMp5WAA6yXs+SQ==
dependencies:
commander "^11.1.0"
dotenv "^16.4.5"
eciesjs "^0.4.10"
execa "^5.1.1"
fdir "^6.2.0"
ignore "^5.3.0"
object-treeify "1.1.33"
picomatch "^4.0.2"
which "^4.0.0"

"@ecies/ciphers@^0.2.2":
version "0.2.2"
resolved "https://registry.yarnpkg.com/@ecies/ciphers/-/ciphers-0.2.2.tgz#82a15b10a6e502b63fb30915d944b2eaf3ff17ff"
integrity sha512-ylfGR7PyTd+Rm2PqQowG08BCKA22QuX8NzrL+LxAAvazN10DMwdJ2fWwAzRj05FI/M8vNFGm3cv9Wq/GFWCBLg==

"@elastic/ecs-helpers@^2.1.1":
version "2.1.1"
resolved "https://registry.yarnpkg.com/@elastic/ecs-helpers/-/ecs-helpers-2.1.1.tgz#8a375b307c33a959938d9ae8f9abb466eb9fb3bf"
Expand Down Expand Up @@ -796,6 +816,23 @@
dependencies:
sparse-bitfield "^3.0.3"

"@noble/ciphers@^1.0.0":
version "1.2.1"
resolved "https://registry.yarnpkg.com/@noble/ciphers/-/ciphers-1.2.1.tgz#3812b72c057a28b44ff0ad4aff5ca846e5b9cdc9"
integrity sha512-rONPWMC7PeExE077uLE4oqWrZ1IvAfz3oH9LibVAcVCopJiA9R62uavnbEzdkVmJYI6M6Zgkbeb07+tWjlq2XA==

"@noble/curves@^1.6.0":
version "1.8.1"
resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.8.1.tgz#19bc3970e205c99e4bdb1c64a4785706bce497ff"
integrity sha512-warwspo+UYUPep0Q+vtdVB4Ugn8GGQj8iyB3gnRWsztmUHTI3S1nhdiWNsPUGL0vud7JlRRk1XEu7Lq1KGTnMQ==
dependencies:
"@noble/hashes" "1.7.1"

"@noble/[email protected]", "@noble/hashes@^1.5.0":
version "1.7.1"
resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.7.1.tgz#5738f6d765710921e7a751e00c20ae091ed8db0f"
integrity sha512-B8XBPsn4vT/KJAGqDzbwztd+6Yte3P4V7iafm24bxgDe/mlRuK6xmWPuCNrKt2vDafZ8MfJLlchDG/vYafQEjQ==

"@nodelib/[email protected]":
version "2.1.5"
resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5"
Expand Down Expand Up @@ -2050,6 +2087,11 @@ commander@^10.0.0:
resolved "https://registry.yarnpkg.com/commander/-/commander-10.0.1.tgz#881ee46b4f77d1c1dccc5823433aa39b022cbe06"
integrity sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==

commander@^11.1.0:
version "11.1.0"
resolved "https://registry.yarnpkg.com/commander/-/commander-11.1.0.tgz#62fdce76006a68e5c1ab3314dc92e800eb83d906"
integrity sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ==

commander@^2.15.1, commander@^2.20.0:
version "2.20.3"
resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33"
Expand Down Expand Up @@ -2478,6 +2520,11 @@ doctypes@^1.1.0:
resolved "https://registry.yarnpkg.com/doctypes/-/doctypes-1.1.0.tgz#ea80b106a87538774e8a3a4a5afe293de489e0a9"
integrity sha512-LLBi6pEqS6Do3EKQ3J0NqHWV5hhb78Pi8vvESYwyOy2c31ZEZVdtitdzsQsKb7878PEERhzUk0ftqGhG6Mz+pQ==

dotenv@^16.4.5:
version "16.4.7"
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.4.7.tgz#0e20c5b82950140aa99be360a8a5f52335f53c26"
integrity sha512-47qPchRCykZC03FhkYAhrvwU4xDBFIj1QPqaarj6mdM/hgUzfPHcpkHJOn3mJAufFeeAxAzeGsr5X0M4k6fLZQ==

dunder-proto@^1.0.0, dunder-proto@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/dunder-proto/-/dunder-proto-1.0.1.tgz#d7ae667e1dc83482f8b70fd0f6eefc50da30f58a"
Expand All @@ -2494,6 +2541,16 @@ [email protected]:
dependencies:
safe-buffer "^5.0.1"

eciesjs@^0.4.10:
version "0.4.14"
resolved "https://registry.yarnpkg.com/eciesjs/-/eciesjs-0.4.14.tgz#a48c527f7754b4390dfd7e863fe0166c1972be94"
integrity sha512-eJAgf9pdv214Hn98FlUzclRMYWF7WfoLlkS9nWMTm1qcCwn6Ad4EGD9lr9HXMBfSrZhYQujRE+p0adPRkctC6A==
dependencies:
"@ecies/ciphers" "^0.2.2"
"@noble/ciphers" "^1.0.0"
"@noble/curves" "^1.6.0"
"@noble/hashes" "^1.5.0"

[email protected]:
version "1.1.1"
resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d"
Expand Down Expand Up @@ -2983,7 +3040,7 @@ events@^3.3.0:
resolved "https://registry.yarnpkg.com/events/-/events-3.3.0.tgz#31a95ad0a924e2d2c419a813aeb2c4e878ea7400"
integrity sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==

execa@^5.0.0:
execa@^5.0.0, execa@^5.1.1:
version "5.1.1"
resolved "https://registry.yarnpkg.com/execa/-/execa-5.1.1.tgz#f80ad9cbf4298f7bd1d4c9555c21e93741c411dd"
integrity sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==
Expand Down Expand Up @@ -3140,6 +3197,11 @@ fd-slicer@~1.1.0:
dependencies:
pend "~1.2.0"

fdir@^6.2.0:
version "6.4.3"
resolved "https://registry.yarnpkg.com/fdir/-/fdir-6.4.3.tgz#011cdacf837eca9b811c89dbb902df714273db72"
integrity sha512-PMXmW2y1hDDfTSRc9gaXIuCCRpuoz3Kaz8cUelp3smouvfT632ozg2vrT6lJsHKKOF59YLbOGfAWGUcKEfRMQw==

fecha@^2.3.3:
version "2.3.3"
resolved "https://registry.yarnpkg.com/fecha/-/fecha-2.3.3.tgz#948e74157df1a32fd1b12c3a3c3cdcb6ec9d96cd"
Expand Down Expand Up @@ -3688,7 +3750,7 @@ ignore-by-default@^1.0.1:
resolved "https://registry.yarnpkg.com/ignore-by-default/-/ignore-by-default-1.0.1.tgz#48ca6d72f6c6a3af00a9ad4ae6876be3889e2b09"
integrity sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==

ignore@^5.1.1, ignore@^5.2.0:
ignore@^5.1.1, ignore@^5.2.0, ignore@^5.3.0:
version "5.3.2"
resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.3.2.tgz#3cd40e729f3643fd87cb04e50bf0eb722bc596f5"
integrity sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==
Expand Down Expand Up @@ -4047,6 +4109,11 @@ isexe@^2.0.0:
resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10"
integrity sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==

isexe@^3.1.1:
version "3.1.1"
resolved "https://registry.yarnpkg.com/isexe/-/isexe-3.1.1.tgz#4a407e2bd78ddfb14bea0c27c6f7072dde775f0d"
integrity sha512-LpB/54B+/2J5hqQ7imZHfdU31OlgQqx7ZicVlkm9kzg9/w8GKLEcFfJl/t7DCEDueOyBAD6zCCwTO6Fzs0NoEQ==

istanbul-lib-coverage@^3.0.0, istanbul-lib-coverage@^3.2.0:
version "3.2.2"
resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz#2d166c4b0644d43a39f04bf6c2edd1e585f31756"
Expand Down Expand Up @@ -5349,6 +5416,11 @@ object-keys@^1.1.1:
resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e"
integrity sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==

[email protected]:
version "1.1.33"
resolved "https://registry.yarnpkg.com/object-treeify/-/object-treeify-1.1.33.tgz#f06fece986830a3cba78ddd32d4c11d1f76cdf40"
integrity sha512-EFVjAYfzWqWsBMRHPMAXLCDIJnpMhdWAqR7xG6M6a2cs6PMFpl/+Z20w9zDW4vkxOFfddegBKq9Rehd0bxWE7A==

object.assign@^4.1.2, object.assign@^4.1.7:
version "4.1.7"
resolved "https://registry.yarnpkg.com/object.assign/-/object.assign-4.1.7.tgz#8c14ca1a424c6a561b0bb2a22f66f5049a945d3d"
Expand Down Expand Up @@ -5630,6 +5702,11 @@ picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.2.3, picomatch@^2.3.1:
resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42"
integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==

picomatch@^4.0.2:
version "4.0.2"
resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-4.0.2.tgz#77c742931e8f3b8820946c76cd0c1f13730d1dab"
integrity sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==

pino-abstract-transport@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/pino-abstract-transport/-/pino-abstract-transport-1.2.0.tgz#97f9f2631931e242da531b5c66d3079c12c9d1b5"
Expand Down Expand Up @@ -7279,6 +7356,13 @@ [email protected], which@^2.0.1:
dependencies:
isexe "^2.0.0"

which@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/which/-/which-4.0.0.tgz#cd60b5e74503a3fbcfbf6cd6b4138a8bae644c1a"
integrity sha512-GlaYyEb07DPxYCKhKzplCWBJtvxZcZMrL+4UkrTSJHHPyZU4mYYTv3qaOe77H7EODLSSopAUFAc6W8U4yqvscg==
dependencies:
isexe "^3.1.1"

winston-compat@^0.1.4:
version "0.1.5"
resolved "https://registry.yarnpkg.com/winston-compat/-/winston-compat-0.1.5.tgz#2eb7f578d4dc390c9c93f943ec2275015ee42148"
Expand Down

0 comments on commit fe2add9

Please sign in to comment.