@realtimex/email-automator 2.3.4 → 2.3.5
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/api/src/config/index.ts +17 -7
- package/dist/api/src/config/index.js +18 -6
- package/package.json +1 -1
package/api/src/config/index.ts
CHANGED
|
@@ -15,16 +15,26 @@ function findPackageRoot(startDir: string): string {
|
|
|
15
15
|
}
|
|
16
16
|
current = dirname(current);
|
|
17
17
|
}
|
|
18
|
-
return process.cwd();
|
|
18
|
+
return process.cwd();
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
function loadEnvironment() {
|
|
22
|
+
const cwdEnv = join(process.cwd(), '.env');
|
|
23
|
+
const rootEnv = join(findPackageRoot(__dirname), '.env');
|
|
24
|
+
|
|
25
|
+
if (existsSync(cwdEnv)) {
|
|
26
|
+
console.log(`📝 Loading environment from CWD: ${cwdEnv}`);
|
|
27
|
+
dotenv.config({ path: cwdEnv, override: true });
|
|
28
|
+
} else if (existsSync(rootEnv)) {
|
|
29
|
+
console.log(`📝 Loading environment from Root: ${rootEnv}`);
|
|
30
|
+
dotenv.config({ path: rootEnv, override: true });
|
|
31
|
+
} else {
|
|
32
|
+
// Just run default dotenv config in case it's in a standard location
|
|
33
|
+
dotenv.config();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
25
36
|
|
|
26
|
-
|
|
27
|
-
dotenv.config({ path: join(packageRoot, '.env') });
|
|
37
|
+
loadEnvironment();
|
|
28
38
|
|
|
29
39
|
function parseArgs(args: string[]): { port: number | null, noUi: boolean } {
|
|
30
40
|
const portIndex = args.indexOf('--port');
|
|
@@ -13,13 +13,25 @@ function findPackageRoot(startDir) {
|
|
|
13
13
|
}
|
|
14
14
|
current = dirname(current);
|
|
15
15
|
}
|
|
16
|
-
return process.cwd();
|
|
16
|
+
return process.cwd();
|
|
17
17
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
function loadEnvironment() {
|
|
19
|
+
const cwdEnv = join(process.cwd(), '.env');
|
|
20
|
+
const rootEnv = join(findPackageRoot(__dirname), '.env');
|
|
21
|
+
if (existsSync(cwdEnv)) {
|
|
22
|
+
console.log(`📝 Loading environment from CWD: ${cwdEnv}`);
|
|
23
|
+
dotenv.config({ path: cwdEnv, override: true });
|
|
24
|
+
}
|
|
25
|
+
else if (existsSync(rootEnv)) {
|
|
26
|
+
console.log(`📝 Loading environment from Root: ${rootEnv}`);
|
|
27
|
+
dotenv.config({ path: rootEnv, override: true });
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
// Just run default dotenv config in case it's in a standard location
|
|
31
|
+
dotenv.config();
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
loadEnvironment();
|
|
23
35
|
function parseArgs(args) {
|
|
24
36
|
const portIndex = args.indexOf('--port');
|
|
25
37
|
let port = null;
|