@mesh-tech/mesh-cli
Version:
CLI for Mesh platform development utilities
52 lines (51 loc) • 2.68 kB
JavaScript
import { Option } from "commander";
import { execCommand } from "./exec.js";
import { setCommand } from "./set.js";
import { reindexCommand } from "./reindex.js";
import { migrateConfigCommand } from "./migrate-config.js";
export function registerSecretsCommands(program) {
const secrets = program
.command("secrets")
.description("AWS Secrets Manager utilities");
secrets
.command("exec")
.description("Run command with secrets as environment variables")
.allowUnknownOption(true)
.action(async (_opts, cmd) => {
const args = cmd.args;
await execCommand(args);
});
secrets
.command("set [service]")
.description("Set credentials for an external service (e.g., mesh secrets set external/symitar)")
.option("--key <key>", "Instance key for multi-instance services (e.g., FI ID)")
.option("--all", "Prompt for all fields including optional ones")
.option("--json <json>", "Non-interactive: provide values as JSON")
.option("--stack <stack>", "Pulumi stack name (override detection)")
.addOption(new Option("--stage <stack>", "Deprecated alias for --stack").hideHelp())
.option("--region <region>", "AWS region (default: us-east-2)")
.action(async (service, opts) => {
await setCommand(service, opts);
});
secrets
.command("reindex [service]")
.description("Rebuild a multi-instance external service's instance index (the {prefix}/.index secret listInstances() reads) from the per-key secrets actually in Secrets Manager — the repair for an instance secret created or deleted out of band")
.option("--dry-run", "Show what would change without writing")
.option("--stack <stack>", "Pulumi stack name (override detection)")
.addOption(new Option("--stage <stack>", "Deprecated alias for --stack").hideHelp())
.option("--region <region>", "AWS region (default: us-east-2)")
.action(async (service, opts) => {
await reindexCommand(service, opts);
});
secrets
.command("migrate-config")
.description("Backfill .config mirror secrets for all external services")
.option("--force", "Overwrite existing .config mirrors")
.option("--dry-run", "Show what would be written without writing")
.option("--stack <stack>", "Pulumi stack name (override detection)")
.addOption(new Option("--stage <stack>", "Deprecated alias for --stack").hideHelp())
.option("--region <region>", "AWS region (default: us-east-2)")
.action(async (opts) => {
await migrateConfigCommand(opts);
});
}