File tree Expand file tree Collapse file tree 5 files changed +19
-6
lines changed
Expand file tree Collapse file tree 5 files changed +19
-6
lines changed Original file line number Diff line number Diff line change 1- import brokerConfig from 'tailchat-server-sdk/dist/runner/moleculer.config' ;
1+ import {
2+ defaultBrokerConfig ,
3+ config ,
4+ BrokerOptions ,
5+ } from 'tailchat-server-sdk' ;
26
3- export default {
4- ...brokerConfig ,
7+ const brokerConfig : BrokerOptions = {
8+ ...defaultBrokerConfig ,
59} ;
10+
11+ if ( config . feature . disableLogger === true ) {
12+ brokerConfig . logger = false ;
13+ }
14+
15+ export default brokerConfig ;
Original file line number Diff line number Diff line change 1+ export { defaultBrokerConfig } from './runner/moleculer.config' ;
12export { TcService } from './services/base' ;
23export { TcBroker } from './services/broker' ;
34export type { TcDbService } from './services/mixins/db.mixin' ;
@@ -49,6 +50,7 @@ export * from './const';
4950
5051// other
5152export { Utils , Errors } from 'moleculer' ;
53+ export type { BrokerOptions } from 'moleculer' ;
5254
5355/**
5456 * 统一处理未捕获的错误, 防止直接把应用打崩
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ import 'moleculer-repl';
3636 * }
3737 * }
3838 */
39- const brokerConfig : BrokerOptions = {
39+ export const defaultBrokerConfig : BrokerOptions = {
4040 // Namespace of nodes to segment your nodes on the same network.
4141 namespace : 'tailchat' ,
4242 // Unique node identifier. Must be unique in a namespace.
@@ -310,5 +310,3 @@ const brokerConfig: BrokerOptions = {
310310 stopped: async (broker: ServiceBroker): Promise<void> => {},
311311 */
312312} ;
313-
314- export default brokerConfig ;
Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ export const config = {
3737 apiUrl,
3838 staticUrl : `${ apiUrl } /static/` ,
3939 enableOpenapi : true , // 是否开始openapi
40+
4041 emailVerification : checkEnvTrusty ( process . env . EMAIL_VERIFY ) || false , // 是否在注册后验证邮箱可用性
4142 smtp : {
4243 senderName : process . env . SMTP_SENDER , // 发邮件者显示名称
@@ -45,6 +46,7 @@ export const config = {
4546 enablePrometheus : checkEnvTrusty ( process . env . PROMETHEUS ) ,
4647 feature : {
4748 disableFileCheck : checkEnvTrusty ( process . env . DISABLE_FILE_CHECK ) ,
49+ disableLogger : checkEnvTrusty ( process . env . DISABLE_LOGGER ) , // 是否关闭日志
4850 } ,
4951} ;
5052
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ title: 环境变量
2020| SMTP_URI
| -
| 邮件服务连接地址(示例:
` smtp://username:[email protected] /?pool=true ` )
| 2121| FILE_LIMIT | 1048576 | 文件/图片上传的大小限制,默认为1m,请输入数字 |
2222| EMAIL_VERIFY | - | 是否开启邮箱校验, 如果为 "1" 或者 "true" 则在注册时增加邮箱校验控制 |
23+ | DISABLE_LOGGER | - | 是否禁用日志输出, 如果为 "1" 或者 "true" 则在运行中关闭日志 |
2324
2425> 部分环境变量示例可见: https://github.com/msgbyte/tailchat/blob/master/server/.env.example
2526
You can’t perform that action at this time.
0 commit comments