config.default.js 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. 'use strict';
  2. const path = require('path');
  3. /**
  4. * 默认配置
  5. */
  6. module.exports = (appInfo) => {
  7. const config = {};
  8. /**
  9. * 应用模式配置
  10. */
  11. config.developmentMode = {
  12. default: 'vue',
  13. mode: {
  14. vue: {
  15. hostname: 'localhost',
  16. port: 8080
  17. },
  18. react: {
  19. hostname: 'localhost',
  20. port: 3000
  21. },
  22. html: {
  23. hostname: 'localhost',
  24. indexPage: 'index.html'
  25. },
  26. }
  27. };
  28. /**
  29. * 开发者工具
  30. */
  31. config.openDevTools = false;
  32. /**
  33. * 应用程序顶部菜单
  34. */
  35. config.openAppMenu = 'dev-show';
  36. /**
  37. * 主窗口
  38. */
  39. config.windowsOption = {
  40. title: 'EE框架',
  41. width: 980,
  42. height: 650,
  43. minWidth: 800,
  44. minHeight: 650,
  45. webPreferences: {
  46. //webSecurity: false, // 跨域问题 -> 打开注释
  47. contextIsolation: false, // false -> 可在渲染进程中使用electron的api,true->需要bridge.js(contextBridge)
  48. nodeIntegration: true,
  49. //preload: path.join(appInfo.baseDir, 'preload', 'bridge.js'),
  50. },
  51. frame: true,
  52. show: false,
  53. icon: path.join(appInfo.home, 'public', 'images', 'logo-32.png'),
  54. };
  55. /**
  56. * ee框架日志
  57. */
  58. config.logger = {
  59. encoding: 'utf8',
  60. level: 'INFO',
  61. outputJSON: false,
  62. buffer: true,
  63. enablePerformanceTimer: false,
  64. rotator: 'day',
  65. appLogName: 'ee.log',
  66. coreLogName: 'ee-core.log',
  67. errorLogName: 'ee-error.log'
  68. }
  69. /**
  70. * 远程模式-web地址
  71. */
  72. config.remoteUrl = {
  73. enable: false,
  74. url: 'http://electron-egg.kaka996.com/'
  75. };
  76. /**
  77. * 内置socket服务
  78. */
  79. config.socketServer = {
  80. enable: false,
  81. port: 7070,
  82. path: "/socket.io/",
  83. connectTimeout: 45000,
  84. pingTimeout: 30000,
  85. pingInterval: 25000,
  86. maxHttpBufferSize: 1e8,
  87. transports: ["polling", "websocket"],
  88. cors: {
  89. origin: true,
  90. }
  91. };
  92. /**
  93. * 内置http服务
  94. */
  95. config.httpServer = {
  96. enable: false,
  97. https: {
  98. enable: false,
  99. key: '/public/ssl/localhost+1.key',
  100. cert: '/public/ssl/localhost+1.pem'
  101. },
  102. port: 7071,
  103. cors: {
  104. origin: "*"
  105. },
  106. body: {
  107. multipart: true,
  108. formidable: {
  109. keepExtensions: true
  110. }
  111. },
  112. filterRequest: {
  113. uris: [
  114. 'favicon.ico'
  115. ],
  116. returnData: ''
  117. }
  118. };
  119. /**
  120. * 主进程
  121. */
  122. config.mainServer = {
  123. protocol: 'file://',
  124. indexPath: '/public/dist/index.html',
  125. host: 'localhost',
  126. port: 7072,
  127. };
  128. /**
  129. * 硬件加速
  130. */
  131. config.hardGpu = {
  132. enable: false
  133. };
  134. /**
  135. * 异常捕获
  136. */
  137. config.exception = {
  138. mainExit: false,
  139. childExit: true,
  140. rendererExit: true,
  141. };
  142. /**
  143. * 插件功能
  144. */
  145. config.addons = {
  146. window: {
  147. enable: true,
  148. },
  149. tray: {
  150. enable: true,
  151. title: 'EE程序',
  152. icon: '/public/images/tray.png'
  153. },
  154. security: {
  155. enable: true,
  156. },
  157. awaken: {
  158. enable: true,
  159. protocol: 'ee',
  160. args: []
  161. },
  162. autoUpdater: {
  163. enable: true,
  164. windows: false,
  165. macOS: false,
  166. linux: false,
  167. options: {
  168. provider: 'generic',
  169. url: 'http://kodo.qiniu.com/'
  170. },
  171. force: false,
  172. },
  173. javaServer: {
  174. enable: false,
  175. port: 18080,
  176. jreVersion: 'jre1.8.0_201',
  177. opt: '-server -Xms512M -Xmx512M -Xss512k -Dspring.profiles.active=prod -Dserver.port=${port} -Dlogging.file.path="${path}" ',
  178. name: 'java-app.jar'
  179. }
  180. };
  181. return {
  182. ...config
  183. };
  184. }