v3.accords-library.com/astro.config.ts

43 lines
1.2 KiB
TypeScript
Raw Normal View History

2024-01-21 12:28:48 +00:00
import icon from "astro-icon";
import { defineConfig } from "astro/config";
import node from "@astrojs/node";
2024-01-21 13:42:52 +00:00
import astroMetaTags from "astro-meta-tags";
2024-03-10 20:24:36 +00:00
import { loadEnv } from "vite";
2024-03-10 20:41:34 +00:00
const { ASTRO_PORT, ASTRO_HOST } = loadEnv(process.env.NODE_ENV ?? "dev", process.cwd(), "");
2024-01-21 12:28:48 +00:00
// https://astro.build/config
export default defineConfig({
output: "server",
srcDir: "./src",
publicDir: "./public",
outDir: "./dist",
adapter: node({
mode: "standalone",
}),
integrations: [
2024-06-15 21:05:51 +00:00
// We can't just call a function on startup because of some Vite's BS...
// So instead I'm exposing some endpoint that only does something the first time it's called.
{
name: "on-server-start",
hooks: {
2024-06-15 21:24:33 +00:00
"astro:config:done": () => {
2024-06-19 06:58:28 +00:00
console.log("Running on startup script in 10s...");
2024-06-15 21:24:33 +00:00
setTimeout(() => fetch(`http://${ASTRO_HOST}:${ASTRO_PORT}/en/api/on-startup`), 10_000);
2024-06-15 21:05:51 +00:00
},
},
},
2024-01-21 13:42:52 +00:00
astroMetaTags(),
2024-01-21 12:28:48 +00:00
icon({
include: {
"material-symbols": ["*"], // Loads entire Material Design Icon set
},
}),
],
prefetch: false,
2024-06-15 21:05:51 +00:00
devToolbar: { enabled: false },
2024-01-21 12:28:48 +00:00
server: {
2024-03-10 20:41:34 +00:00
port: parseInt(ASTRO_PORT ?? "4321"),
host: ASTRO_HOST ?? true,
2024-01-21 12:28:48 +00:00
},
});