@zenifra/cli 0.3.1 → 0.3.2
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/bin/zenifra.mjs +13 -1
- package/package.json +1 -1
package/bin/zenifra.mjs
CHANGED
|
@@ -1813,6 +1813,18 @@ function envsForOutput(envs, { showValues = false } = {}) {
|
|
|
1813
1813
|
}));
|
|
1814
1814
|
}
|
|
1815
1815
|
|
|
1816
|
+
const PROJECT_INFO_SECRET_FIELD = /(?:^|_)(?:api_?key|access_?token|refresh_?token|secret|password|credential|connection_string|private_?jwk)(?:$|_)/i;
|
|
1817
|
+
|
|
1818
|
+
function projectInfoForOutput(value, key = '') {
|
|
1819
|
+
if (key === 'envs' && Array.isArray(value)) return envsForOutput(value);
|
|
1820
|
+
if (Array.isArray(value)) return value.map((item) => projectInfoForOutput(item, key));
|
|
1821
|
+
if (!value || typeof value !== 'object') return PROJECT_INFO_SECRET_FIELD.test(key) ? maskEnvValue(value) : value;
|
|
1822
|
+
return Object.fromEntries(Object.entries(value).map(([entryKey, entryValue]) => [
|
|
1823
|
+
entryKey,
|
|
1824
|
+
PROJECT_INFO_SECRET_FIELD.test(entryKey) ? maskEnvValue(entryValue) : projectInfoForOutput(entryValue, entryKey),
|
|
1825
|
+
]));
|
|
1826
|
+
}
|
|
1827
|
+
|
|
1816
1828
|
function formatPublicUrl(value) {
|
|
1817
1829
|
const raw = String(value || '').trim();
|
|
1818
1830
|
if (!raw) return '';
|
|
@@ -3559,7 +3571,7 @@ async function handleProjectInfo(session, flags) {
|
|
|
3559
3571
|
const orgId = await resolveOrgId(session, flags);
|
|
3560
3572
|
const project = await getProject(session, flags, projectId, orgId);
|
|
3561
3573
|
|
|
3562
|
-
if (flags.json) return printJson(project);
|
|
3574
|
+
if (flags.json) return printJson(projectInfoForOutput(project));
|
|
3563
3575
|
printProject({ ...project, id: projectId });
|
|
3564
3576
|
}
|
|
3565
3577
|
|