⚙️ Enhance caching mechanism and add refresh option for secret retrieval

This commit is contained in:
2026-04-06 13:24:01 +08:00
parent 7689b6be11
commit aef9c77aee
2 changed files with 137 additions and 18 deletions

View File

@@ -1,10 +1,10 @@
#!/usr/bin/env -S deno run -A
import {args, exit, getSecretValue,} from "https://script.hatter.ink/@62/deno-commons-mod.ts";
import {args, exit, getSecretValue,} from "https://script.hatter.ink/@66/deno-commons-mod.ts";
import {parseArgs} from "jsr:@std/cli/parse-args";
const flags = parseArgs(args(), {
boolean: ["help"],
boolean: ["help", "refresh"],
string: ["id"],
});
@@ -19,7 +19,11 @@ if (flags.help) {
}
if (flags.id) {
console.log(await getSecretValue(flags.id));
console.log(
await getSecretValue(flags.id, {
tryRefresh: flags.refresh,
}),
);
exit(0);
} else {
console.error("get-secret.ts --id is required");