-
Notifications
You must be signed in to change notification settings - Fork 0
/
svelte.config.js
65 lines (60 loc) · 1.34 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import adapterStatic from '@sveltejs/adapter-static'
import adapterCloudflare from '@sveltejs/adapter-cloudflare'
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte'
let adapter,
default_src
switch (process.env.ADAPTER) {
case 'cloudflare':
adapter = adapterCloudflare({
routes: {
include: ['/*'],
exclude: ['<all>']
}
})
break;
default:
adapter = adapterStatic({
precompress: true,
fallback: '404.html'
})
}
switch (process.env.PPOCGEN_ENV) {
case 'production':
default_src = ['self', 'https://ppocgen.com', 'ws://ppocgen.com']
break
case 'staging':
default_src = ['self', 'https://dev.ppocgen.com', 'ws://dev.ppocgen.com']
break
default:
default_src = ['self']
}
/** @type {import('@sveltejs/kit').Config} */
const config = {
preprocess: vitePreprocess(),
kit: {
adapter: adapter,
serviceWorker: {
register: false,
},
paths: {
base: '',
relative: false
},
csp: {
directives: {
'default-src': ["'self'"],
'script-src': ["'self'"],
'style-src': ["'self'", "'unsafe-inline'"],
'img-src': ["'self'", 'data:'],
'connect-src': ["'self'", 'https://api.open-meteo.com', 'https://nominatim.openstreetmap.org'],
'font-src': ["'self'"],
'frame-src': ["'none'"],
}
},
csrf: {
checkOrigin: true
},
embedded: false
}
}
export default config