config.default.js 3.3 KB

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