@vita-mojo/aggregator 1.9.0 → 1.11.0
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/main.js.enc +0 -0
- package/main.js.map.enc +0 -0
- package/package.json +1 -1
- package/postinstall.js +44 -0
package/main.js.enc
CHANGED
|
Binary file
|
package/main.js.map.enc
CHANGED
|
Binary file
|
package/package.json
CHANGED
package/postinstall.js
CHANGED
|
@@ -5,6 +5,49 @@ const fs = require('fs');
|
|
|
5
5
|
const path = require('path');
|
|
6
6
|
const crypto = require('crypto');
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Load environment variables from .env file
|
|
10
|
+
*/
|
|
11
|
+
function loadEnvFile() {
|
|
12
|
+
// Navigate up to repo root (from node_modules/@cicd_vitamojo/aggregator)
|
|
13
|
+
const repoRoot = path.resolve(__dirname, '../../../..');
|
|
14
|
+
const envFilePath = path.join(repoRoot, '.env');
|
|
15
|
+
|
|
16
|
+
if (!fs.existsSync(envFilePath)) {
|
|
17
|
+
console.log('ℹ No .env file found in repo root');
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
try {
|
|
22
|
+
const envContent = fs.readFileSync(envFilePath, 'utf-8');
|
|
23
|
+
const lines = envContent.split('\n');
|
|
24
|
+
|
|
25
|
+
for (const line of lines) {
|
|
26
|
+
const trimmed = line.trim();
|
|
27
|
+
|
|
28
|
+
// Skip empty lines and comments
|
|
29
|
+
if (!trimmed || trimmed.startsWith('#')) {
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const [key, ...valueParts] = trimmed.split('=');
|
|
34
|
+
const value = valueParts.join('=').trim();
|
|
35
|
+
|
|
36
|
+
// Remove quotes if present
|
|
37
|
+
const cleanValue = value.replace(/^['"]|['"]$/g, '');
|
|
38
|
+
|
|
39
|
+
// Only set if not already in environment
|
|
40
|
+
if (!process.env[key]) {
|
|
41
|
+
process.env[key] = cleanValue;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
console.log('✓ Loaded environment variables from .env file');
|
|
46
|
+
} catch (error) {
|
|
47
|
+
console.error(`⚠ Failed to read .env file: ${error.message}`);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
8
51
|
/**
|
|
9
52
|
* Decrypt a file using a shared secret
|
|
10
53
|
*/
|
|
@@ -83,6 +126,7 @@ function decryptFiles() {
|
|
|
83
126
|
* Main execution
|
|
84
127
|
*/
|
|
85
128
|
try {
|
|
129
|
+
loadEnvFile();
|
|
86
130
|
decryptFiles();
|
|
87
131
|
} catch (error) {
|
|
88
132
|
console.error('\n❌ Aggregator decryption failed:', error.message);
|