q-koa 8.4.2 → 8.4.3
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/core/app.js +12 -13
- package/core/file/utils/index.js +9 -0
- package/package.json +1 -1
package/core/app.js
CHANGED
|
@@ -290,16 +290,16 @@ class APP {
|
|
|
290
290
|
process.on('exit', (code) => {
|
|
291
291
|
console.log(`[exit custom], About to exit with code: ${code}`)
|
|
292
292
|
})
|
|
293
|
+
if (
|
|
294
|
+
this.app[appName].service.cache &&
|
|
295
|
+
this.app[appName].service.cache.init
|
|
296
|
+
) {
|
|
297
|
+
this.app[appName].service.cache.init({
|
|
298
|
+
app: this.app[appName],
|
|
299
|
+
appName: appName,
|
|
300
|
+
})
|
|
301
|
+
}
|
|
293
302
|
if (process.env.NODE_ENV === 'production') {
|
|
294
|
-
if (
|
|
295
|
-
this.app[appName].service.cache &&
|
|
296
|
-
this.app[appName].service.cache.init
|
|
297
|
-
) {
|
|
298
|
-
this.app[appName].service.cache.init({
|
|
299
|
-
app: this.app[appName],
|
|
300
|
-
appName: appName,
|
|
301
|
-
})
|
|
302
|
-
}
|
|
303
303
|
process.on('SIGINT', () => {
|
|
304
304
|
console.log('Closing server...')
|
|
305
305
|
this.server.close(() => {
|
|
@@ -365,7 +365,7 @@ class APP {
|
|
|
365
365
|
this.config.app
|
|
366
366
|
),
|
|
367
367
|
}
|
|
368
|
-
}else{
|
|
368
|
+
} else {
|
|
369
369
|
this.app[appName] = {
|
|
370
370
|
sequelize: db,
|
|
371
371
|
appConfig: _.defaultsDeep(
|
|
@@ -374,7 +374,6 @@ class APP {
|
|
|
374
374
|
),
|
|
375
375
|
}
|
|
376
376
|
}
|
|
377
|
-
|
|
378
377
|
|
|
379
378
|
// const proxyConfig = _.get(this.app[appName], 'appConfig.proxy');
|
|
380
379
|
// const taskConfig = _.get(this.app[appName], 'appConfig.task', {
|
|
@@ -1876,11 +1875,11 @@ APP.getConfig = (app) => ({
|
|
|
1876
1875
|
}))
|
|
1877
1876
|
)
|
|
1878
1877
|
|
|
1879
|
-
const result = getObject(configList)(type)
|
|
1878
|
+
const result = getObject(configList, app)(type)
|
|
1880
1879
|
if (!result) throw new Error('没有这个type')
|
|
1881
1880
|
return result
|
|
1882
1881
|
}
|
|
1883
|
-
const result = getObject(configList)(type)
|
|
1882
|
+
const result = getObject(configList, app)(type)
|
|
1884
1883
|
if (!result) throw new Error('没有这个type')
|
|
1885
1884
|
return result
|
|
1886
1885
|
},
|
package/core/file/utils/index.js
CHANGED
|
@@ -16,6 +16,15 @@ exports.getList = (config) => (type) => {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
exports.getObject = (config) => (type) => {
|
|
19
|
+
if (app) {
|
|
20
|
+
const applicationList = await app.cache.get('application')
|
|
21
|
+
if (
|
|
22
|
+
applicationList &&
|
|
23
|
+
applicationList.find((item) => item.config === type)
|
|
24
|
+
) {
|
|
25
|
+
return applicationList.find((item) => item.config === type)
|
|
26
|
+
}
|
|
27
|
+
}
|
|
19
28
|
const obj = config.find((i) => i.code === type)
|
|
20
29
|
if (!obj) throw new Error(`找不到${type}相关设置`)
|
|
21
30
|
const list = config.filter((i) => i.parent_id === obj.id)
|