@nginstack/engine-node 89.0.1 → 89.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/Engine.js +25 -3
- package/package.json +2 -2
package/lib/Engine.js
CHANGED
|
@@ -485,9 +485,7 @@ class Engine {
|
|
|
485
485
|
static newUsingWorkspaceConfig(options) {
|
|
486
486
|
options = options || {};
|
|
487
487
|
const workspacePath = getWorkspacePath();
|
|
488
|
-
|
|
489
|
-
path: path.resolve(workspacePath, '.env')
|
|
490
|
-
});
|
|
488
|
+
loadWorkspaceEnv(workspacePath);
|
|
491
489
|
|
|
492
490
|
if (!('jazSearchPath' in options)) {
|
|
493
491
|
let jazSearchPath = path.resolve(workspacePath, '.build');
|
|
@@ -532,4 +530,28 @@ function getWorkspacePath() {
|
|
|
532
530
|
return path.dirname(workspacePath);
|
|
533
531
|
}
|
|
534
532
|
|
|
533
|
+
/**
|
|
534
|
+
* Loads the environment variables from the ".env" files on the workspace root. The files are
|
|
535
|
+
* read in the order ".env.local", ".env.windows" or ".env.linux" (according to the platform) and
|
|
536
|
+
* ".env". The first value found for a variable prevails, and variables already defined in the
|
|
537
|
+
* process environment are not overwritten.
|
|
538
|
+
* @param {string} workspacePath Workspace root path.
|
|
539
|
+
*/
|
|
540
|
+
function loadWorkspaceEnv(workspacePath) {
|
|
541
|
+
const candidates = ['.env.local'];
|
|
542
|
+
if (os.platform() === 'win32') {
|
|
543
|
+
candidates.push('.env.windows');
|
|
544
|
+
} else if (os.platform() === 'linux') {
|
|
545
|
+
candidates.push('.env.linux');
|
|
546
|
+
}
|
|
547
|
+
candidates.push('.env');
|
|
548
|
+
|
|
549
|
+
const envPaths = candidates
|
|
550
|
+
.map((name) => path.resolve(workspacePath, name))
|
|
551
|
+
.filter((envPath) => fs.existsSync(envPath));
|
|
552
|
+
if (envPaths.length > 0) {
|
|
553
|
+
dotenv.config({ path: envPaths });
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
|
|
535
557
|
module.exports = Engine;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nginstack/engine-node",
|
|
3
|
-
"version": "89.0.
|
|
3
|
+
"version": "89.0.21",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -24,5 +24,5 @@
|
|
|
24
24
|
"thread-sleep": "^2.2.0",
|
|
25
25
|
"tmp": "^0.2.1"
|
|
26
26
|
},
|
|
27
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "aa02f033fabf8bf695bca1571358f7d4c26d3f51"
|
|
28
28
|
}
|