MCPcopy
hub / github.com/docmirror/dev-sidecar / startup

Function startup

packages/cli/src/index.js:7–27  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

5// 启动服务
6const mitmproxyPath = './mitmproxy'
7async function startup () {
8 const banner = fs.readFileSync('./banner.txt')
9 console.log(banner.toString())
10
11 const configPath = './user_config.json5'
12 if (fs.existsSync(configPath)) {
13 const file = fs.readFileSync(configPath)
14 let userConfig
15 try {
16 userConfig = jsonApi.parse(file.toString())
17 console.info(`读取和解析 user_config.json5 成功:${configPath}`)
18 } catch (e) {
19 console.error(`读取或解析 user_config.json5 失败: ${configPath}, error:`, e)
20 userConfig = {}
21 }
22 DevSidecar.api.config.set(userConfig)
23 }
24
25 await DevSidecar.api.startup({ mitmproxyPath })
26 console.log('dev-sidecar 已启动')
27}
28
29async function onClose () {
30 console.log('on sigint ')

Callers 1

index.jsFile · 0.70

Calls 1

logMethod · 0.80

Tested by

no test coverage detected