15815213711
2024-08-26 67b8b6731811983447e053d4396b3708c14dfe3c
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/**
 * 该模块不在增加新功能,请使用 /module/utils/index 模块
 */
 
const path = require('path');
const UtilsJson = require('../utils/json');
const UtilsPs = require('../ps');
const UtilsHelper = require('../utils/helper');
const Copy = require('../utils/copyto');
const Conf = require('../config');
const Channel = require('../const/channel');
 
/**
 * other module
 */
Copy(UtilsPs)
.and(UtilsHelper)
.to(exports);
 
/**
 * 获取项目根目录package.json
 */
exports.getPackage = function() {
  const json = UtilsJson.readSync(path.join(this.getHomeDir(), 'package.json'));
  
  return json;
};
 
/**
 * 获取 ee配置
 */
exports.getEeConfig = function() {
  const config = Conf.all();
 
  return config;
}
 
/**
 * 获取 app version
 */
exports.getAppVersion = function() {
  const v = Conf.all().appVersion;
  return v;
}
 
/**
 * 获取 插件配置
 */
exports.getAddonConfig = function() {
  const cfg = Conf.all().addons;
  return cfg;
}
 
/**
 * 获取 mainServer配置
 */
exports.getMainServerConfig = function() {
  const cfg = Conf.all().mainServer;
  return cfg;
}
 
/**
 * 获取 httpServer配置
 */
exports.getHttpServerConfig = function() {
  const cfg = Conf.all().httpServer;
  return cfg;
}
 
/**
 * 获取 socketServer配置
 */
exports.getSocketServerConfig = function() {
  const cfg = Conf.all().socketServer;
  return cfg;
}
 
/**
 * 获取 socketio port
 */
exports.getSocketPort = function() {
  const port = Conf.all().socketServer.port;
  return parseInt(port);
}
 
/**
 * 获取 socket channel
 */
exports.getSocketChannel = function() {
  return Channel.socketIo.partySoftware;
}