envpkt 0.6.4 → 0.6.6
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/dist/cli.js +20 -10
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -2440,10 +2440,7 @@ const printConfig = (config, path, resolveResult, opts) => {
|
|
|
2440
2440
|
console.log("");
|
|
2441
2441
|
console.log(`${BOLD}Environment Defaults:${RESET} ${envKeys.length}`);
|
|
2442
2442
|
for (const [key, entry] of Object.entries(envEntries)) {
|
|
2443
|
-
|
|
2444
|
-
const statusIcon = currentValue === void 0 ? `${RED}!${RESET}` : currentValue === entry.value ? `${GREEN}=${RESET}` : `${YELLOW}~${RESET}`;
|
|
2445
|
-
const statusLabel = currentValue === void 0 ? `${DIM}not set${RESET}` : currentValue === entry.value ? `${DIM}using default${RESET}` : `${YELLOW}overridden${RESET}`;
|
|
2446
|
-
console.log(` ${statusIcon} ${BOLD}${key}${RESET} = "${entry.value}" ${statusLabel}`);
|
|
2443
|
+
console.log(` ${BOLD}${key}${RESET} = "${entry.value}"`);
|
|
2447
2444
|
if (entry.purpose) console.log(` purpose: ${entry.purpose}`);
|
|
2448
2445
|
if (entry.comment) console.log(` comment: ${DIM}${entry.comment}${RESET}`);
|
|
2449
2446
|
}
|
|
@@ -2475,7 +2472,8 @@ const runInspect = (options) => {
|
|
|
2475
2472
|
console.error(formatError(err));
|
|
2476
2473
|
process.exit(2);
|
|
2477
2474
|
}, (config) => {
|
|
2478
|
-
|
|
2475
|
+
const configDir = dirname(path);
|
|
2476
|
+
resolveConfig(config, configDir).fold((err) => {
|
|
2479
2477
|
console.error(formatError(err));
|
|
2480
2478
|
process.exit(2);
|
|
2481
2479
|
}, (resolveResult) => {
|
|
@@ -2486,10 +2484,23 @@ const runInspect = (options) => {
|
|
|
2486
2484
|
return;
|
|
2487
2485
|
}
|
|
2488
2486
|
const showSecrets = showConfig.secret ?? {};
|
|
2489
|
-
const printOpts = options.secrets ? {
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2487
|
+
const printOpts = options.secrets ? (() => {
|
|
2488
|
+
const sealedEntries = Object.fromEntries(Object.entries(showSecrets).filter(([, meta]) => meta.encrypted_value));
|
|
2489
|
+
return {
|
|
2490
|
+
secrets: Object.keys(sealedEntries).length > 0 ? (() => {
|
|
2491
|
+
const identityPath = showConfig.identity?.key_file ? resolve(configDir, expandPath(showConfig.identity.key_file)) : (() => {
|
|
2492
|
+
const defaultPath = resolveKeyPath();
|
|
2493
|
+
return existsSync(defaultPath) ? defaultPath : void 0;
|
|
2494
|
+
})();
|
|
2495
|
+
if (!identityPath) return {};
|
|
2496
|
+
return unsealSecrets(sealedEntries, identityPath).fold((err) => {
|
|
2497
|
+
console.error(`${YELLOW}Warning:${RESET} Could not decrypt sealed secrets: ${err.message}`);
|
|
2498
|
+
return {};
|
|
2499
|
+
}, (d) => d);
|
|
2500
|
+
})() : {},
|
|
2501
|
+
secretDisplay: options.plaintext ? "plaintext" : "encrypted"
|
|
2502
|
+
};
|
|
2503
|
+
})() : void 0;
|
|
2493
2504
|
printConfig(showConfig, path, showResolved ? resolveResult : void 0, printOpts);
|
|
2494
2505
|
});
|
|
2495
2506
|
});
|
|
@@ -2974,7 +2985,6 @@ const writeSealedToml = (configPath, sealedMeta) => {
|
|
|
2974
2985
|
output.push(`encrypted_value = """`);
|
|
2975
2986
|
output.push(pendingSeals.get(currentMetaKey));
|
|
2976
2987
|
output.push(`"""`);
|
|
2977
|
-
output.push("");
|
|
2978
2988
|
pendingSeals.delete(currentMetaKey);
|
|
2979
2989
|
} else output.push(line);
|
|
2980
2990
|
if (line.slice(line.indexOf("=") + 1).trim().includes("\"\"\"")) {
|