v1.0.21
This commit is contained in:
@@ -103,6 +103,19 @@ export const setSecretFile = async ({ absFilePath, secretKey, secretValue }) =>
|
||||
logger.success(`adding secret for ${absFilePath} with Key ${secretKey.toUpperCase()} done`);
|
||||
await decryptFile(absFilePath);
|
||||
};
|
||||
export const setRawFile = async ({ absFilePath, secretKey, secretValue }) => {
|
||||
if (!fs.existsSync(absFilePath)) {
|
||||
logger.error(`Secret ${absFilePath} is not exist`);
|
||||
}
|
||||
logger.log(`adding raw secret for ${absFilePath} with Key ${secretKey.toUpperCase()} start`);
|
||||
const secretFileObjRaw = await fs.readFile(absFilePath, "utf8");
|
||||
const secretObj = JSON.parse(secretFileObjRaw);
|
||||
|
||||
secretObj[secretKey.toUpperCase()] = secretValue;
|
||||
saveFileIfItChanged(JSON.stringify(secretObj, null, 4), absFilePath);
|
||||
logger.success(`adding secret for ${absFilePath} with Key ${secretKey.toUpperCase()} done`);
|
||||
await decryptFile(absFilePath);
|
||||
};
|
||||
|
||||
export const commitSecretMeta = async () => {
|
||||
const metadataRepoFolderRelative = getJJConfigByKeyChain(`metadataRepo.path`);
|
||||
@@ -219,6 +232,15 @@ export const secrets = async () => {
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
if (process.env.JJ_CLI_ARG_2 == "setRaw") {
|
||||
await setRawFile({
|
||||
absFilePath,
|
||||
secretKey,
|
||||
secretValue,
|
||||
});
|
||||
|
||||
process.exit(0);
|
||||
}
|
||||
if (process.env.JJ_CLI_ARG_2 == "setSecret") {
|
||||
await setSecretFile({
|
||||
absFilePath,
|
||||
|
||||
Reference in New Issue
Block a user