config.default.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  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. host: 'localhost',
  124. port: 7072,
  125. };
  126. /**
  127. * 硬件加速
  128. */
  129. config.hardGpu = {
  130. enable: false
  131. };
  132. /**
  133. * 异常捕获
  134. */
  135. config.exception = {
  136. mainExit: false,
  137. childExit: true,
  138. rendererExit: true,
  139. };
  140. /**
  141. * 插件功能
  142. */
  143. config.addons = {
  144. window: {
  145. enable: true,
  146. },
  147. tray: {
  148. enable: true,
  149. title: 'EE程序',
  150. icon: '/public/images/tray_logo.png'
  151. },
  152. security: {
  153. enable: true,
  154. },
  155. awaken: {
  156. enable: true,
  157. protocol: 'ee',
  158. args: []
  159. },
  160. autoUpdater: {
  161. enable: true,
  162. windows: false,
  163. macOS: false,
  164. linux: false,
  165. options: {
  166. provider: 'generic',
  167. url: 'http://kodo.qiniu.com/'
  168. },
  169. force: false,
  170. },
  171. javaServer: {
  172. enable: false,
  173. port: 18080,
  174. jreVersion: 'jre1.8.0_201',
  175. opt: '-server -Xms512M -Xmx512M -Xss512k -Dspring.profiles.active=prod -Dserver.port=${port} -Dlogging.file.path="${path}" ',
  176. name: 'java-app.jar'
  177. }
  178. };
  179. return {
  180. ...config
  181. };
  182. }