update openclaw secret

This commit is contained in:
2026-03-08 14:23:49 +08:00
parent 89efa30195
commit dbdc022fb3

View File

@@ -110,14 +110,20 @@ async function getSecretValue(
}
const flags = parseArgs(args(), {
boolean: ["help"],
boolean: ["help", "direct-output"],
collect: ["id"],
alias: {
d: "direct-output",
},
});
if (flags.help) {
console.log(
"export RUN_ENV=ALIBABA_CLOUD or `echo ALIBABA_CLOUD > ~/.config/envs/RUN_ENV` runs on Alibaba Cloud",
);
console.log(
"openclaw-secret.ts --id ID1 [--id ID2] [--direct-output|-d]",
);
console.log(
'echo \'{"protocolVersion": 1, "provider": "vault", "ids": ["providers/openai/apiKey"]}\' | openclaw-secret.ts',
);
@@ -152,6 +158,18 @@ if (openClawInput.protocolVersion !== 1) {
exit(1);
}
if (flags["direct-output"]) {
if (openClawInput.ids.length != 1) {
console.error(
`--direct-output requires only one id`,
openClawInput.ids,
);
exit(1);
}
console.log(await getSecretValue(isOnAlibabaCloud, openClawInput.ids[0]));
exit(0);
}
for (const id of openClawInput.ids) {
try {
values[id] = await getSecretValue(isOnAlibabaCloud, id);