-
Notifications
You must be signed in to change notification settings - Fork 0
/
astro.config.mjs
71 lines (63 loc) · 2.29 KB
/
astro.config.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// @ts-check
import node from "@astrojs/node";
import { defineConfig, envField } from "astro/config";
/**
* @param {Omit<Parameters<typeof envField.string>[0], 'context'|'optional'>} options
* @returns {ReturnType<typeof envField.string>}
*/
function optionalServerString(options) {
/** @type{Parameters<typeof envField.string>[0]} */
const defaultArgs = {
context: "server",
access: "secret", // Always overwritten, but the types don't check without this.
optional: true,
};
return envField.string(Object.assign(defaultArgs, options));
}
/**
* @param {Omit<Parameters<typeof envField.string>[0], 'context'|'access'>} options
* @returns {ReturnType<typeof envField.string>}
*/
function clientString(options) {
/** @type{Parameters<typeof envField.string>[0]} */
const defaultArgs = {
context: "client",
access: "public",
};
return envField.string(Object.assign(defaultArgs, options));
}
// https://astro.build/config
export default defineConfig({
output: "server",
adapter: node({
mode: "standalone",
}),
experimental: {
env: {
schema: {
// Names for TAG repositories. These are variables so that development instances can
// override them.
TAG_ORG: clientString({ default: "w3ctag" }),
REVIEWS_REPO: clientString({ default: "design-reviews" }),
PRIVATE_BRAINSTORMING_REPO: clientString({
default: "design-reviews-private-brainstorming",
}),
MEETINGS_REPO: clientString({ default: "meetings" }),
// These are all defined in the Github App registration. The environment must set these or
// GITHUB_TOKEN, below.
APP_ID: optionalServerString({ access: "public" }),
PRIVATE_KEY: optionalServerString({ access: "secret" }),
CLIENT_ID: optionalServerString({ access: "public" }),
CLIENT_SECRET: optionalServerString({ access: "secret" }),
// Technically optional when testing the non-webhook parts of the server, but easy enough to
// give a fake value.
WEBHOOK_SECRET: envField.string({
context: "server",
access: "secret",
}),
// Use a personal token to test the server without registering it as a whole app.
GITHUB_TOKEN: optionalServerString({ access: "secret" }),
},
},
},
});