chore: rename src/ to server/

This commit is contained in:
CrescentLeaf
2025-08-30 14:43:45 +08:00
parent 5e756636a9
commit 5666bcba24
16 changed files with 2 additions and 2 deletions

39
server/config.ts Normal file
View File

@@ -0,0 +1,39 @@
import fs from 'node:fs/promises'
import chalk from 'chalk'
const default_data_path = "./thewhitesilk_data"
let config = {
data_path: default_data_path,
server: {
use: "http",
/**
* used in server.listen()
*/
listen: {
port: 3601,
host: "::",
/**
* setting ipv6Only to true will disable dual-stack support, i.e., binding to host :: won't make 0.0.0.0 be bound.
*/
ipv6Only: false,
},
/**
* used in https.createServer()
*/
https: {
key: default_data_path + '/key.pem',
cert: default_data_path + '/cert.pem',
},
},
}
try {
config = JSON.parse(await fs.readFile('thewhitesilk_config.json', 'utf-8'))
} catch (_e) {
console.log(chalk.yellow("配置文件貌似不存在, 正在创建..."))
await fs.writeFile('thewhitesilk_config.json', JSON.stringify(config))
}
await fs.mkdir(config.data_path, { recursive: true })
export default config