config.default.js 3.2 KB

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