mirror of
https://gitee.com/dromara/electron-egg.git
synced 2026-05-14 19:52:10 +08:00
196 lines
3.4 KiB
JavaScript
196 lines
3.4 KiB
JavaScript
'use strict';
|
||
|
||
const dayjs = require('dayjs');
|
||
const path = require('path');
|
||
|
||
/**
|
||
* 默认配置
|
||
*/
|
||
module.exports = (appInfo) => {
|
||
|
||
const config = {};
|
||
|
||
/**
|
||
* 应用模式配置
|
||
*/
|
||
config.developmentMode = {
|
||
default: 'vue',
|
||
mode: {
|
||
vue: {
|
||
hostname: 'localhost',
|
||
port: 8080
|
||
},
|
||
react: {
|
||
hostname: 'localhost',
|
||
port: 3000
|
||
},
|
||
html: {
|
||
hostname: 'localhost',
|
||
indexPage: 'index.html'
|
||
},
|
||
}
|
||
};
|
||
|
||
/**
|
||
* 开发者工具
|
||
*/
|
||
config.openDevTools = false;
|
||
|
||
/**
|
||
* 应用程序顶部菜单
|
||
*/
|
||
config.openAppMenu = 'dev-show';
|
||
|
||
/**
|
||
* 主窗口
|
||
*/
|
||
config.windowsOption = {
|
||
title: 'EE框架',
|
||
width: 980,
|
||
height: 650,
|
||
minWidth: 800,
|
||
minHeight: 650,
|
||
webPreferences: {
|
||
//webSecurity: false, // 跨域问题 -> 打开注释
|
||
contextIsolation: false, // false -> 可在渲染进程中使用electron的api,true->需要bridge.js(contextBridge)
|
||
nodeIntegration: true,
|
||
//preload: path.join(appInfo.baseDir, 'preload', 'bridge.js'),
|
||
},
|
||
frame: true,
|
||
show: false,
|
||
icon: path.join(appInfo.home, 'public', 'images', 'logo-32.png'),
|
||
};
|
||
|
||
/**
|
||
* ee框架日志
|
||
*/
|
||
config.logger = {
|
||
appLogName: `ee-${dayjs().format('YYYY-MM-DD')}.log`,
|
||
errorLogName: `ee-error-${dayjs().format('YYYY-MM-DD')}.log`
|
||
}
|
||
|
||
/**
|
||
* 远程模式-web地址
|
||
*/
|
||
config.remoteUrl = {
|
||
enable: false,
|
||
url: 'http://electron-egg.kaka996.com/'
|
||
};
|
||
|
||
/**
|
||
* 内置socket服务
|
||
*/
|
||
config.socketServer = {
|
||
enable: false,
|
||
port: 7070,
|
||
path: "/socket.io/",
|
||
connectTimeout: 45000,
|
||
pingTimeout: 30000,
|
||
pingInterval: 25000,
|
||
maxHttpBufferSize: 1e8,
|
||
transports: ["polling", "websocket"],
|
||
cors: {
|
||
origin: true,
|
||
}
|
||
};
|
||
|
||
/**
|
||
* 内置http服务
|
||
*/
|
||
config.httpServer = {
|
||
enable: false,
|
||
https: {
|
||
enable: false,
|
||
key: '/public/ssl/localhost+1.key',
|
||
cert: '/public/ssl/localhost+1.pem'
|
||
},
|
||
port: 7071,
|
||
cors: {
|
||
origin: "*"
|
||
},
|
||
body: {
|
||
multipart: true,
|
||
formidable: {
|
||
keepExtensions: true
|
||
}
|
||
},
|
||
filterRequest: {
|
||
uris: [
|
||
'favicon.ico'
|
||
],
|
||
returnData: ''
|
||
}
|
||
};
|
||
|
||
/**
|
||
* 主进程
|
||
*/
|
||
config.mainServer = {
|
||
host: 'localhost',
|
||
port: 7072,
|
||
};
|
||
|
||
/**
|
||
* 硬件加速
|
||
*/
|
||
config.hardGpu = {
|
||
enable: false
|
||
};
|
||
|
||
/**
|
||
* 异常捕获
|
||
*/
|
||
config.exception = {
|
||
mainExit: false,
|
||
childExit: true,
|
||
rendererExit: true,
|
||
};
|
||
|
||
/**
|
||
* 插件功能
|
||
*/
|
||
config.addons = {
|
||
window: {
|
||
enable: true,
|
||
},
|
||
tray: {
|
||
enable: true,
|
||
title: 'EE程序',
|
||
icon: '/public/images/tray_logo.png'
|
||
},
|
||
security: {
|
||
enable: true,
|
||
},
|
||
awaken: {
|
||
enable: true,
|
||
protocol: 'ee',
|
||
args: []
|
||
},
|
||
autoUpdater: {
|
||
enable: true,
|
||
windows: false,
|
||
macOS: false,
|
||
linux: false,
|
||
options: {
|
||
provider: 'generic',
|
||
url: 'http://kodo.qiniu.com/'
|
||
},
|
||
force: false,
|
||
},
|
||
javaServer: {
|
||
enable: false,
|
||
port: 18080,
|
||
jreVersion: 'jre1.8.0_201',
|
||
opt: '-server -Xms512M -Xmx512M -Xss512k -Dspring.profiles.active=prod -Dserver.port=${port} -Dlogging.file.path="${path}" ',
|
||
name: 'java-app.jar'
|
||
},
|
||
example: {
|
||
enable: false,
|
||
},
|
||
};
|
||
|
||
return {
|
||
...config
|
||
};
|
||
}
|