fix: Add nixpacks configuration for Astro deployment

This commit is contained in:
Kunthawat Greethong
2026-03-02 12:35:14 +07:00
parent ede8e32591
commit 5a2fb71c40
10118 changed files with 1500179 additions and 24 deletions

View File

@@ -0,0 +1,17 @@
import type { Logger } from '../../../core/logger/core.js';
import type { KeyGenerator } from '../definitions.js';
interface Options {
logger: Logger;
keyGenerator: KeyGenerator;
}
export declare const createKeyCommand: {
help: {
commandName: string;
tables: {
Flags: [string, string][];
};
description: string;
};
run({ logger, keyGenerator }: Options): Promise<void>;
};
export {};

View File

@@ -0,0 +1,22 @@
import { defineCommand } from "../../domain/command.js";
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.
ASTRO_KEY=${key}`
);
}
});
export {
createKeyCommand
};

View File

@@ -0,0 +1,3 @@
export interface KeyGenerator {
generate: () => Promise<string>;
}

View File

@@ -0,0 +1,4 @@
import type { KeyGenerator } from '../definitions.js';
export declare class CryptoKeyGenerator implements KeyGenerator {
generate(): Promise<string>;
}

View File

@@ -0,0 +1,11 @@
import { createKey, encodeKey } from "../../../core/encryption.js";
class CryptoKeyGenerator {
async generate() {
const key = await createKey();
const encoded = await encodeKey(key);
return encoded;
}
}
export {
CryptoKeyGenerator
};