-
Notifications
You must be signed in to change notification settings - Fork 6
/
astro.config.ts
80 lines (79 loc) · 2.52 KB
/
astro.config.ts
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
72
73
74
75
76
77
78
79
80
import mdx from '@astrojs/mdx';
import zeabur from '@zeabur/astro-adapter/serverless';
import { uploader } from 'astro-uploader';
import { defineConfig, envField } from 'astro/config';
import rehypeAutolinkHeadings from 'rehype-autolink-headings';
import rehypeExternalLinks from 'rehype-external-links';
import rehypeSlug from 'rehype-slug';
import options from './options';
import { astroImage } from './plugins/images';
// https://astro.build/config
export default defineConfig({
// This will override the import.meta.env.SITE. No need to introduce method.
site: options.isProd() ? options.website : options.local.website,
output: 'server',
security: {
checkOrigin: true,
},
image: {
domains: ['localhost', '127.0.0.1'],
service: !options.isProd() ? { entrypoint: './plugins/resize', config: {} } : undefined,
},
experimental: {
contentLayer: true,
contentIntellisense: true,
env: {
schema: {
// Postgres Database
POSTGRES_HOST: envField.string({ context: 'server', access: 'secret' }),
POSTGRES_PORT: envField.number({ context: 'server', access: 'secret' }),
POSTGRES_USERNAME: envField.string({ context: 'server', access: 'secret' }),
POSTGRES_PASSWORD: envField.string({ context: 'server', access: 'secret' }),
POSTGRES_DATABASE: envField.string({ context: 'server', access: 'secret' }),
// Artalk Comment
ARTALK_HOST: envField.string({ context: 'server', access: 'secret' }),
},
validateSecrets: true,
},
},
integrations: [
mdx({
remarkPlugins: [astroImage],
rehypePlugins: [
[rehypeExternalLinks, { rel: 'nofollow', target: '_blank' }],
rehypeSlug,
[rehypeAutolinkHeadings, { behavior: 'append', properties: {} }],
],
}),
uploader({
paths: ['images', 'og', 'cats'],
endpoint: process.env.S3_ENDPOINT,
bucket: process.env.S3_BUCKET as string,
accessKey: process.env.S3_ACCESS_KEY as string,
secretAccessKey: process.env.S3_SECRET_ACCESS_KEY as string,
}),
],
adapter: zeabur(),
markdown: {
gfm: true,
shikiConfig: {
theme: 'solarized-light',
wrap: false,
},
},
server: {
port: options.local.port,
},
devToolbar: {
// I don't need such toolbar.
enabled: false,
},
vite: {
// Add this for avoiding the needless import optimize in Vite.
optimizeDeps: { exclude: ['@napi-rs/canvas', 'opendal', 'sharp'] },
},
build: {
assets: 'cats',
assetsPrefix: options.assetsPrefix(),
},
});