update openclaw secret
This commit is contained in:
@@ -9,7 +9,7 @@ import {
|
|||||||
log,
|
log,
|
||||||
stdinToArrayBuffer,
|
stdinToArrayBuffer,
|
||||||
} from "https://script.hatter.ink/@50/deno-commons-mod.ts";
|
} from "https://script.hatter.ink/@50/deno-commons-mod.ts";
|
||||||
import {parseArgs} from "jsr:@std/cli/parse-args";
|
import { parseArgs } from "jsr:@std/cli/parse-args";
|
||||||
|
|
||||||
// specification: https://docs.openclaw.ai/gateway/secrets
|
// specification: https://docs.openclaw.ai/gateway/secrets
|
||||||
|
|
||||||
@@ -110,14 +110,20 @@ async function getSecretValue(
|
|||||||
}
|
}
|
||||||
|
|
||||||
const flags = parseArgs(args(), {
|
const flags = parseArgs(args(), {
|
||||||
boolean: ["help"],
|
boolean: ["help", "direct-output"],
|
||||||
collect: ["id"],
|
collect: ["id"],
|
||||||
|
alias: {
|
||||||
|
d: "direct-output",
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
if (flags.help) {
|
if (flags.help) {
|
||||||
console.log(
|
console.log(
|
||||||
"export RUN_ENV=ALIBABA_CLOUD or `echo ALIBABA_CLOUD > ~/.config/envs/RUN_ENV` runs on Alibaba Cloud",
|
"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(
|
console.log(
|
||||||
'echo \'{"protocolVersion": 1, "provider": "vault", "ids": ["providers/openai/apiKey"]}\' | openclaw-secret.ts',
|
'echo \'{"protocolVersion": 1, "provider": "vault", "ids": ["providers/openai/apiKey"]}\' | openclaw-secret.ts',
|
||||||
);
|
);
|
||||||
@@ -152,6 +158,18 @@ if (openClawInput.protocolVersion !== 1) {
|
|||||||
exit(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) {
|
for (const id of openClawInput.ids) {
|
||||||
try {
|
try {
|
||||||
values[id] = await getSecretValue(isOnAlibabaCloud, id);
|
values[id] = await getSecretValue(isOnAlibabaCloud, id);
|
||||||
|
|||||||
Reference in New Issue
Block a user