astro
Version:
Astro is a modern site builder with web best practices, performance, and DX front-of-mind.
13 lines (12 loc) • 609 B
JavaScript
import { defineCommand } from "../../domain/command.js";
export const createKeyCommand = defineCommand({
help: {
commandName: "astro create-key",
tables: { Flags: [["--help (-h)", "See all available flags."]] },
description: "Generates a key to encrypt props passed to server islands."
},
async run({ logger, keyGenerator }) {
const key = await keyGenerator.generate();
logger.info("crypto", `Generated a key to encrypt props passed to server islands. To reuse the same key across builds, set this value as ASTRO_KEY in an environment variable on your build server.\n\nASTRO_KEY=${key}`);
}
});