forked from huggingface/chat-ui
-
Notifications
You must be signed in to change notification settings - Fork 1
/
svelte.config.js
46 lines (39 loc) · 1.13 KB
/
svelte.config.js
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
import adapter from "@sveltejs/adapter-node";
import { vitePreprocess } from "@sveltejs/vite-plugin-svelte";
import dotenv from "dotenv";
import { execSync } from "child_process";
dotenv.config({ path: "./.env.local" });
dotenv.config({ path: "./.env" });
function getCurrentCommitSHA() {
try {
return execSync("git rev-parse HEAD").toString();
} catch (error) {
console.error("Error getting current commit SHA:", error);
return "unknown";
}
}
process.env.PUBLIC_VERSION ??= process.env.npm_package_version;
process.env.PUBLIC_COMMIT_SHA = getCurrentCommitSHA();
/** @type {import('@sveltejs/kit').Config} */
const config = {
// Consult https://kit.svelte.dev/docs/integrations#preprocessors
// for more information about preprocessors
preprocess: vitePreprocess(),
kit: {
adapter: adapter(),
paths: {
base: process.env.APP_BASE || "",
relative: false,
},
csrf: {
// handled in hooks.server.ts, because we can have multiple valid origins
checkOrigin: false,
},
csp: {
directives: {
...(process.env.ALLOW_IFRAME === "true" ? {} : { "frame-ancestors": ["'none'"] }),
},
},
},
};
export default config;