fix: 为图片进程启动必要的配置

This commit is contained in:
ningmengchongshui 2024-06-14 23:46:47 +08:00
parent d84987567a
commit 413f8ef887
4 changed files with 11 additions and 24 deletions

View File

@ -1,10 +1,14 @@
import '../src/init/modules.js'
import '../src/init/logger.js'
import '../src/init/config.js'
import '../src/init/redis.js'
import './tailwindcss.js'
import Koa from 'koa'
import KoaStatic from 'koa-static'
import Router from 'koa-router'
import { Component } from 'yunzai/utils'
import { readdirSync } from 'fs'
import { join } from 'path'
import './tailwindcss.js'
const Com = new Component()
const app = new Koa()

View File

@ -1,42 +1,28 @@
import './init/modules.js'
import './init/logger.js'
import './init/config.js'
import './init/redis.js'
import { promises } from 'node:fs'
import yaml from 'yaml'
import { configInit } from './config/config'
import { BOT_NAME } from './config'
import { redisInit } from './config/redis'
import { CONFIG_INIT_PATH } from './config/system.js'
import { checkRun } from './config/check.js'
/**
*
*/
logger.mark(`${BOT_NAME} 启动中...`)
/**
*
*/
configInit()
/**
*
*/
await redisInit()
/**
*
*/
process.title = BOT_NAME
/**
*
*/
process.env.TZ = 'Asia/Shanghai'
/**
*
*/
process.on('SIGHUP', () => process.exit())
/**
*
*/
@ -44,7 +30,6 @@ process.on('uncaughtException', error => {
if (typeof logger == 'undefined') console.log(error)
else logger.error(error)
})
/**
* Promise错误
*/
@ -52,7 +37,6 @@ process.on('unhandledRejection', error => {
if (typeof logger == 'undefined') console.log(error)
else logger.error(error)
})
/**
* 退
*/
@ -66,18 +50,15 @@ process.on('exit', async () => {
logger.mark(logger.magenta(`${BOT_NAME} 已停止运行`))
}
})
/**
*
*/
let title = BOT_NAME
//
const qq = await promises
.readFile(`./${CONFIG_INIT_PATH}qq.yaml`, 'utf-8')
.then(yaml.parse)
.catch(() => null)
/**
*
*/
@ -113,12 +94,10 @@ if (qq) {
}
}
}
/**
*
*/
process.title = title
/**
*
*/

2
src/init/config.ts Normal file
View File

@ -0,0 +1,2 @@
import { configInit } from '../config/config.js'
configInit()

2
src/init/redis.ts Normal file
View File

@ -0,0 +1,2 @@
import { redisInit } from '../config/redis'
await redisInit()