@suronai/cli 0.1.12 → 0.1.14
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/package.json +1 -1
- package/src/utils/dotenvx.js +9 -0
package/package.json
CHANGED
package/src/utils/dotenvx.js
CHANGED
|
@@ -13,9 +13,18 @@ export function encryptDotenv(cwd) {
|
|
|
13
13
|
if (!existsSync(join(cwd, ".env"))) {
|
|
14
14
|
throw new Error(`.env not found in ${cwd}`);
|
|
15
15
|
}
|
|
16
|
+
// Strip DOTENV_PRIVATE_KEY from the child environment.
|
|
17
|
+
// If dotenvx sees an existing key it reuses that keypair and skips
|
|
18
|
+
// writing .env.keys, which breaks readPrivateKey() immediately after.
|
|
19
|
+
const env = { ...process.env };
|
|
20
|
+
for (const k of Object.keys(env)) {
|
|
21
|
+
if (k.startsWith("DOTENV_PRIVATE_KEY")) delete env[k];
|
|
22
|
+
}
|
|
23
|
+
|
|
16
24
|
try {
|
|
17
25
|
const output = execSync("npx @dotenvx/dotenvx encrypt", {
|
|
18
26
|
cwd,
|
|
27
|
+
env,
|
|
19
28
|
stdio: ["inherit", "pipe", "pipe"],
|
|
20
29
|
}).toString();
|
|
21
30
|
if (output) process.stdout.write(output);
|