-
Notifications
You must be signed in to change notification settings - Fork 4
/
app.config.ts
59 lines (53 loc) · 1.85 KB
/
app.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
// biome-ignore lint/correctness/noNodejsModules: build
import { existsSync } from 'node:fs'
// biome-ignore lint/correctness/noNodejsModules: build
import { dirname, join } from 'node:path'
// biome-ignore lint/correctness/noNodejsModules: build
import { fileURLToPath } from 'node:url'
import { SolidStartInlineConfig, defineConfig } from '@solidjs/start/config'
import viteConfig, { isDev } from './vite.config'
const isVercel = Boolean(process.env.VERCEL)
const isNetlify = Boolean(process.env.NETLIFY)
const isBun = Boolean(process.env.BUN)
const isCI = Boolean(process.env.CI || process.env.GITHUB_ACTIONS)
const preset = isNetlify ? 'netlify' : isVercel ? 'vercel_edge' : isBun ? 'bun' : 'node'
console.info(`[app.config] solid-start preset {> ${preset} <}`)
// certs for local development
const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename)
const keyPath = join(__dirname, 'key.pem')
const certPath = join(__dirname, 'cert.pem')
// Функция для проверки SSL
function checkSSL(): { key: string; cert: string } | undefined {
// Пропускаем для всех случаев кроме локальной разработки
if (!isDev || isCI || isVercel || isNetlify || process.argv.includes('build')) {
return undefined
}
try {
// Только проверяем существующие сертификаты
if (existsSync(keyPath) && existsSync(certPath)) {
return {
key: keyPath,
cert: certPath
}
}
} catch {
// Игнорируем любые ошибки
}
return undefined
}
export default defineConfig({
nitro: {
timing: true,
compatibilityDate: '2024-11-29'
},
ssr: true,
server: {
preset,
port: 3000,
https: checkSSL(),
streaming: false
},
devOverlay: isDev,
vite: viteConfig
} as SolidStartInlineConfig)