ee-core 2.0.1 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/addon/index.js +2 -2
- package/ee/baseApp.js +0 -10
- package/httpclient/index.js +2 -3
- package/log/logger.js +2 -10
- package/oldUtils/index.js +10 -25
- package/package.json +1 -1
- package/ps/index.js +1 -8
- package/utils/index.js +0 -71
package/addon/index.js
CHANGED
|
@@ -14,7 +14,7 @@ const Addon = {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
if (!this[EEAddon].has(name)) {
|
|
17
|
-
this[EEAddon]
|
|
17
|
+
this[EEAddon].set(name, obj);
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
20
|
|
|
@@ -22,7 +22,7 @@ const Addon = {
|
|
|
22
22
|
* 获取插件对象
|
|
23
23
|
*/
|
|
24
24
|
get(name) {
|
|
25
|
-
let addon = this[EEAddon].has(name) ? this[EEAddon]
|
|
25
|
+
let addon = this[EEAddon].has(name) ? this[EEAddon].get(name): null;
|
|
26
26
|
return addon;
|
|
27
27
|
},
|
|
28
28
|
}
|
package/ee/baseApp.js
CHANGED
|
@@ -7,7 +7,6 @@ const HttpClient = require('../httpclient');
|
|
|
7
7
|
const HTTPCLIENT = Symbol('EeApplication#httpclient');
|
|
8
8
|
const LOGGERS = Symbol('EeApplication#loggers');
|
|
9
9
|
const Log = require('../log');
|
|
10
|
-
const Storage = require('../storage');
|
|
11
10
|
const Conf = require('../config');
|
|
12
11
|
|
|
13
12
|
class BaseApp extends EeAppCore {
|
|
@@ -75,15 +74,6 @@ class BaseApp extends EeAppCore {
|
|
|
75
74
|
get coreLogger() {
|
|
76
75
|
return this.getLogger('coreLogger');
|
|
77
76
|
}
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* @class core存储模块
|
|
81
|
-
* @since 1.0.0
|
|
82
|
-
*/
|
|
83
|
-
getCoreDB () {
|
|
84
|
-
const db = Storage.connection('system');
|
|
85
|
-
return db;
|
|
86
|
-
}
|
|
87
77
|
|
|
88
78
|
/**
|
|
89
79
|
* @class curl
|
package/httpclient/index.js
CHANGED
|
@@ -3,7 +3,7 @@ const HttpsAgent = require('agentkeepalive').HttpsAgent;
|
|
|
3
3
|
const urllib = require('urllib');
|
|
4
4
|
const ms = require('humanize-ms');
|
|
5
5
|
const { FrameworkBaseError } = require('egg-errors');
|
|
6
|
-
const
|
|
6
|
+
const Conf = require('../config');
|
|
7
7
|
const Log = require('../log');
|
|
8
8
|
|
|
9
9
|
class HttpClientError extends FrameworkBaseError {
|
|
@@ -16,8 +16,7 @@ class HttpClient extends urllib.HttpClient2 {
|
|
|
16
16
|
constructor(options = {}) {
|
|
17
17
|
|
|
18
18
|
if (Object.keys(options).length == 0) {
|
|
19
|
-
|
|
20
|
-
options = sysConfig.httpclient;
|
|
19
|
+
options = Conf.getValue('httpclient');
|
|
21
20
|
}
|
|
22
21
|
|
|
23
22
|
const config = Object.assign({
|
package/log/logger.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const Loggers = require('egg-logger').EggLoggers;
|
|
2
2
|
const assert = require('assert');
|
|
3
3
|
const Ps = require('../ps');
|
|
4
|
-
const
|
|
4
|
+
const Conf = require('../config');
|
|
5
5
|
|
|
6
6
|
module.exports = {
|
|
7
7
|
|
|
@@ -33,7 +33,7 @@ module.exports = {
|
|
|
33
33
|
},
|
|
34
34
|
customLogger: {}
|
|
35
35
|
}
|
|
36
|
-
const sysConfig =
|
|
36
|
+
const sysConfig = Conf.all();
|
|
37
37
|
opt = Object.assign(defaultConfig, {
|
|
38
38
|
logger: sysConfig.logger,
|
|
39
39
|
customLogger: sysConfig.customLogger || {}
|
|
@@ -50,12 +50,4 @@ module.exports = {
|
|
|
50
50
|
|
|
51
51
|
return loggers;
|
|
52
52
|
},
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* 获取 coredb
|
|
56
|
-
*/
|
|
57
|
-
_getCoreDB() {
|
|
58
|
-
const coreDB = Storage.connection('system');
|
|
59
|
-
return coreDB;
|
|
60
|
-
}
|
|
61
53
|
};
|
package/oldUtils/index.js
CHANGED
|
@@ -7,8 +7,8 @@ const UtilsJson = require('../utils/json');
|
|
|
7
7
|
const UtilsPs = require('../ps');
|
|
8
8
|
const UtilsHelper = require('../utils/helper');
|
|
9
9
|
const Copy = require('../utils/copyto');
|
|
10
|
-
const
|
|
11
|
-
const
|
|
10
|
+
const Conf = require('../config');
|
|
11
|
+
const Channel = require('../const/channel');
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* other module
|
|
@@ -26,20 +26,11 @@ exports.getPackage = function() {
|
|
|
26
26
|
return json;
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
-
/**
|
|
30
|
-
* 获取 coredb
|
|
31
|
-
*/
|
|
32
|
-
exports.getCoreDB = function() {
|
|
33
|
-
const coreDB = Storage.connection('system');
|
|
34
|
-
return coreDB;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
29
|
/**
|
|
38
30
|
* 获取 ee配置
|
|
39
31
|
*/
|
|
40
32
|
exports.getEeConfig = function() {
|
|
41
|
-
const
|
|
42
|
-
const config = cdb.getItem('config');
|
|
33
|
+
const config = Conf.all();
|
|
43
34
|
|
|
44
35
|
return config;
|
|
45
36
|
}
|
|
@@ -48,8 +39,7 @@ exports.getEeConfig = function() {
|
|
|
48
39
|
* 获取 app version
|
|
49
40
|
*/
|
|
50
41
|
exports.getAppVersion = function() {
|
|
51
|
-
const
|
|
52
|
-
const v = cdb.getItem('config').appVersion;
|
|
42
|
+
const v = Conf.all().appVersion;
|
|
53
43
|
return v;
|
|
54
44
|
}
|
|
55
45
|
|
|
@@ -57,8 +47,7 @@ exports.getAppVersion = function() {
|
|
|
57
47
|
* 获取 插件配置
|
|
58
48
|
*/
|
|
59
49
|
exports.getAddonConfig = function() {
|
|
60
|
-
const
|
|
61
|
-
const cfg = cdb.getItem('config').addons;
|
|
50
|
+
const cfg = Conf.all().addons;
|
|
62
51
|
return cfg;
|
|
63
52
|
}
|
|
64
53
|
|
|
@@ -66,8 +55,7 @@ exports.getAddonConfig = function() {
|
|
|
66
55
|
* 获取 mainServer配置
|
|
67
56
|
*/
|
|
68
57
|
exports.getMainServerConfig = function() {
|
|
69
|
-
const
|
|
70
|
-
const cfg = cdb.getItem('config').mainServer;
|
|
58
|
+
const cfg = Conf.all().mainServer;
|
|
71
59
|
return cfg;
|
|
72
60
|
}
|
|
73
61
|
|
|
@@ -75,8 +63,7 @@ exports.getMainServerConfig = function() {
|
|
|
75
63
|
* 获取 httpServer配置
|
|
76
64
|
*/
|
|
77
65
|
exports.getHttpServerConfig = function() {
|
|
78
|
-
const
|
|
79
|
-
const cfg = cdb.getItem('config').httpServer;
|
|
66
|
+
const cfg = Conf.all().httpServer;
|
|
80
67
|
return cfg;
|
|
81
68
|
}
|
|
82
69
|
|
|
@@ -84,8 +71,7 @@ exports.getHttpServerConfig = function() {
|
|
|
84
71
|
* 获取 socketServer配置
|
|
85
72
|
*/
|
|
86
73
|
exports.getSocketServerConfig = function() {
|
|
87
|
-
const
|
|
88
|
-
const cfg = cdb.getItem('config').socketServer;
|
|
74
|
+
const cfg = Conf.all().socketServer;
|
|
89
75
|
return cfg;
|
|
90
76
|
}
|
|
91
77
|
|
|
@@ -93,8 +79,7 @@ exports.getSocketServerConfig = function() {
|
|
|
93
79
|
* 获取 socketio port
|
|
94
80
|
*/
|
|
95
81
|
exports.getSocketPort = function() {
|
|
96
|
-
const
|
|
97
|
-
const port = cdb.getItem('config').socketServer.port;
|
|
82
|
+
const port = Conf.all().socketServer.port;
|
|
98
83
|
return parseInt(port);
|
|
99
84
|
}
|
|
100
85
|
|
|
@@ -102,5 +87,5 @@ exports.getSocketPort = function() {
|
|
|
102
87
|
* 获取 socket channel
|
|
103
88
|
*/
|
|
104
89
|
exports.getSocketChannel = function() {
|
|
105
|
-
return
|
|
90
|
+
return Channel.socketIo.partySoftware;
|
|
106
91
|
}
|
package/package.json
CHANGED
package/ps/index.js
CHANGED
|
@@ -89,7 +89,7 @@ exports.processType = function() {
|
|
|
89
89
|
};
|
|
90
90
|
|
|
91
91
|
/**
|
|
92
|
-
*
|
|
92
|
+
* 获取home路径
|
|
93
93
|
*/
|
|
94
94
|
exports.getHomeDir = function () {
|
|
95
95
|
return process.env.EE_HOME;
|
|
@@ -164,13 +164,6 @@ exports.getAppUserDataDir = function() {
|
|
|
164
164
|
return process.env.EE_APP_USER_DATA;
|
|
165
165
|
}
|
|
166
166
|
|
|
167
|
-
/**
|
|
168
|
-
* 获取数据存储路径
|
|
169
|
-
*/
|
|
170
|
-
exports.getHomeDir = function () {
|
|
171
|
-
return process.env.EE_HOME;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
167
|
/**
|
|
175
168
|
* 获取 exec目录
|
|
176
169
|
*/
|
package/utils/index.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
|
-
const Storage = require('../storage');
|
|
3
|
-
const Constants = require('../const');
|
|
4
2
|
const Ps = require('../ps');
|
|
5
3
|
const UtilsJson = require('./json');
|
|
6
4
|
|
|
@@ -13,74 +11,5 @@ exports.getPackage = function() {
|
|
|
13
11
|
return json;
|
|
14
12
|
};
|
|
15
13
|
|
|
16
|
-
/**
|
|
17
|
-
* 获取 coredb
|
|
18
|
-
*/
|
|
19
|
-
exports.getCoreDB = function() {
|
|
20
|
-
const coreDB = Storage.connection('system');
|
|
21
|
-
return coreDB;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* 获取 ee配置
|
|
26
|
-
*/
|
|
27
|
-
exports.getEeConfig = function() {
|
|
28
|
-
const cdb = this.getCoreDB();
|
|
29
|
-
const config = cdb.getItem('config');
|
|
30
|
-
|
|
31
|
-
return config;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* 获取 app version
|
|
36
|
-
*/
|
|
37
|
-
exports.getAppVersion = function() {
|
|
38
|
-
const cdb = this.getCoreDB();
|
|
39
|
-
const v = cdb.getItem('config').appVersion;
|
|
40
|
-
return v;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* 获取 插件配置
|
|
45
|
-
*/
|
|
46
|
-
exports.getAddonConfig = function() {
|
|
47
|
-
const cdb = this.getCoreDB();
|
|
48
|
-
const cfg = cdb.getItem('config').addons;
|
|
49
|
-
return cfg;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* 获取 mainServer配置
|
|
54
|
-
*/
|
|
55
|
-
exports.getMainServerConfig = function() {
|
|
56
|
-
const cdb = this.getCoreDB();
|
|
57
|
-
const cfg = cdb.getItem('config').mainServer;
|
|
58
|
-
return cfg;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* 获取 httpServer配置
|
|
63
|
-
*/
|
|
64
|
-
exports.getHttpServerConfig = function() {
|
|
65
|
-
const cdb = this.getCoreDB();
|
|
66
|
-
const cfg = cdb.getItem('config').httpServer;
|
|
67
|
-
return cfg;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* 获取 socketServer配置
|
|
72
|
-
*/
|
|
73
|
-
exports.getSocketServerConfig = function() {
|
|
74
|
-
const cdb = this.getCoreDB();
|
|
75
|
-
const cfg = cdb.getItem('config').socketServer;
|
|
76
|
-
return cfg;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* 获取 socket channel
|
|
81
|
-
*/
|
|
82
|
-
exports.getSocketChannel = function() {
|
|
83
|
-
return Constants.socketIo.channel;
|
|
84
|
-
}
|
|
85
14
|
|
|
86
15
|
|