config.default.js 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  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. channel: "c1",
  72. };
  73. /**
  74. * Cross-language service
  75. * 跨语言服务
  76. * 例如:执行go的二进制程序,默认目录为 ./extraResources/
  77. */
  78. config.cross = {
  79. go: {
  80. enable: false,
  81. name: "goapp",
  82. args: ["--port=7073"],
  83. appExit: true,
  84. },
  85. python: {
  86. enable: false,
  87. name: "pyapp",
  88. cmd: "./py/pyapp",
  89. directory: "./py",
  90. args: ["--port=7074"],
  91. appExit: true,
  92. },
  93. };
  94. /**
  95. * 内置http服务
  96. */
  97. config.httpServer = {
  98. enable: false,
  99. https: {
  100. enable: false,
  101. key: "/public/ssl/localhost+1.key",
  102. cert: "/public/ssl/localhost+1.pem",
  103. },
  104. host: "127.0.0.1",
  105. port: 7071,
  106. cors: {
  107. origin: "*",
  108. },
  109. body: {
  110. multipart: true,
  111. formidable: {
  112. keepExtensions: true,
  113. },
  114. },
  115. filterRequest: {
  116. uris: ["favicon.ico"],
  117. returnData: "",
  118. },
  119. };
  120. /**
  121. * 主进程
  122. */
  123. config.mainServer = {
  124. protocol: "file://",
  125. indexPath: "/public/dist/index.html",
  126. };
  127. /**
  128. * 硬件加速
  129. */
  130. config.hardGpu = {
  131. enable: true,
  132. };
  133. /**
  134. * 异常捕获
  135. */
  136. config.exception = {
  137. mainExit: false,
  138. childExit: true,
  139. rendererExit: true,
  140. };
  141. /**
  142. * jobs
  143. */
  144. config.jobs = {
  145. messageLog: true,
  146. };
  147. /**
  148. * 插件功能
  149. */
  150. config.addons = {
  151. window: {
  152. enable: true,
  153. },
  154. tray: {
  155. enable: true,
  156. title: "EE程序",
  157. icon: "/public/images/tray.png",
  158. },
  159. security: {
  160. enable: true,
  161. },
  162. awaken: {
  163. enable: true,
  164. protocol: "ee",
  165. args: [],
  166. },
  167. autoUpdater: {
  168. enable: true,
  169. windows: false,
  170. macOS: false,
  171. linux: false,
  172. options: {
  173. provider: "generic",
  174. url: "http://kodo.qiniu.com/",
  175. },
  176. force: false,
  177. },
  178. };
  179. return {
  180. ...config,
  181. };
  182. }