mirror of
https://github.com/wallace5303/ee-core.git
synced 2026-04-05 15:39:03 +08:00
1
This commit is contained in:
37
config2.js
37
config2.js
@@ -1,37 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const path = require('path');
|
||||
const dayjs = require('dayjs');
|
||||
const storage = require('./lib/storage');
|
||||
|
||||
const sysConfig = {
|
||||
log: {
|
||||
file: {
|
||||
fileName: path.normalize(storage.getStorageDir() + 'logs/electron-' + dayjs().format('YYYY-MM-DD') + '.log'),
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
exports.get = function (flag = '', env = 'prod') {
|
||||
|
||||
// TODO
|
||||
let config = {};
|
||||
let userConfig = require('../../electron/config');
|
||||
Object.assign(config, userConfig, sysConfig);
|
||||
|
||||
if (flag === 'egg') {
|
||||
const eggConfig = storage.getEggConfig();
|
||||
if (env === 'prod' && eggConfig.port) {
|
||||
config.egg.port = eggConfig.port;
|
||||
}
|
||||
return config.egg;
|
||||
}
|
||||
|
||||
if (flag in config) {
|
||||
return config[flag];
|
||||
}
|
||||
|
||||
return {};
|
||||
};
|
||||
|
||||
exports = module.exports;
|
||||
4
index.js
4
index.js
@@ -38,13 +38,13 @@ const Utils = require('./utils/index');
|
||||
* @member {Socket}
|
||||
* @since 1.0.0
|
||||
*/
|
||||
//const Socket = require('./lib/Socket');
|
||||
const Socket = require('./lib/socket/io');
|
||||
|
||||
module.exports = {
|
||||
Appliaction,
|
||||
Controller,
|
||||
Service,
|
||||
Storage,
|
||||
//Socket,
|
||||
Socket,
|
||||
Utils
|
||||
};
|
||||
40
index2.js
40
index2.js
@@ -1,40 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @namespace EeCore
|
||||
*/
|
||||
|
||||
/**
|
||||
* @member {EeAppliaction} EeCore#EeAppliaction
|
||||
* @since 1.0.0
|
||||
*/
|
||||
exports.Appliaction = require('./lib/application');
|
||||
|
||||
/**
|
||||
* @member {ELogger} EeCore#ELogger
|
||||
* @since 1.0.0
|
||||
*/
|
||||
exports.Logger = require('./lib/eLogger');
|
||||
|
||||
/**
|
||||
* @member {Helper} EeCore#Helper
|
||||
* @since 1.0.0
|
||||
*/
|
||||
exports.Helper = require('./lib/helper');
|
||||
|
||||
/**
|
||||
* @member {Storage} EeCore#Storage
|
||||
*/
|
||||
exports.Storage = require('./lib/storage');
|
||||
|
||||
/**
|
||||
* @member {Controller} EeCore#Controller
|
||||
* @since 1.0.0
|
||||
*/
|
||||
exports.Controller = require('./core/lib/utils/base_context_class');
|
||||
|
||||
/**
|
||||
* @member {Service} EeCore#Service
|
||||
* @since 1.0.0
|
||||
*/
|
||||
exports.Service = require('./core/lib/utils/base_context_class');
|
||||
@@ -1,38 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const path = require('path');
|
||||
const dayjs = require('dayjs');
|
||||
const storage = require('./storage');
|
||||
|
||||
const sysConfig = {
|
||||
log: {
|
||||
file: {
|
||||
fileName: path.normalize(storage.getStorageDir() + 'logs/electron-' + dayjs().format('YYYY-MM-DD') + '.log'),
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
// TODO
|
||||
const config = {};
|
||||
const userConfig = require('../../electron/config');
|
||||
Object.assign(config, userConfig, sysConfig);
|
||||
|
||||
exports.get = function (flag = '', env = 'prod') {
|
||||
|
||||
if (flag === 'egg') {
|
||||
if (env === 'prod') {
|
||||
const eggConfig = storage.getEggConfig();
|
||||
const port = parseInt(eggConfig.port);
|
||||
config.egg.port = port ? port : config.egg.port;
|
||||
}
|
||||
return config.egg;
|
||||
}
|
||||
|
||||
if (flag in config) {
|
||||
return config[flag];
|
||||
}
|
||||
|
||||
return {};
|
||||
};
|
||||
|
||||
exports = module.exports;
|
||||
9
lib/socket/io.js
Normal file
9
lib/socket/io.js
Normal file
@@ -0,0 +1,9 @@
|
||||
'use strict';
|
||||
|
||||
const IoServer = require('socket.io');
|
||||
const IoClient = require('socket.io-client');
|
||||
|
||||
module.exports = {
|
||||
IoServer,
|
||||
IoClient
|
||||
};
|
||||
@@ -108,4 +108,11 @@ exports.getAppUserDataDir = function() {
|
||||
exports.getLogDir = function() {
|
||||
let logPath = path.join(this.getAppUserDataDir(), 'logs');
|
||||
return logPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 socketio port
|
||||
*/
|
||||
exports.getIpcPort = function() {
|
||||
return process.env.EE_IPC_PORT;
|
||||
}
|
||||
Reference in New Issue
Block a user