obtains the configuration file object. The object returns different results depending on the current environment variable.

Usage

  1. this.app.config

description

env

environment variables: local、prod

name

application Name

baseDir

the path of the ‘./electron’ directory in the framework. If encryption is used, the path after packaging is ‘./public/electron’

HOME

APP project directory path

homeDir

APP project directory path

root

the data directory of the APP in the operating system varies according to environment variables.

appUserDataDir

the data directory of the APP in the operating system, independent of environment variables.

userHome

The home directory of the operating system user.

appVersion

APP version

isPackaged

has the APP been packaged?

execDir

after the APP is installed, the root directory of the executable programs (exe, dmg, dep)

logger

APP log configuration

socketServer

built-in socket service configuration

developmentMode

APP type configuration

openDevTools

developer Toolbar

openAppMenu

APP top menu bar

loadingPage

loading page

windowsOption

main window attribute configuration

remoteUrl

APP remote type (web)

autoUpdate

automatic upgrade configuration

awakeProtocol

Wake-up protocol configuration

tray

tray bar configuration

testConfig

user-defined configuration

example of config value:

  1. {
  2. "env": "local",
  3. "name": "ee",
  4. "baseDir": "D:\\www\\xing\\ee\\electron",
  5. "HOME": "D:\\www\\xing\\ee",
  6. "rundir": "D:\\www\\xing\\ee\\electron\\run",
  7. "dump": {
  8. "ignore": {}
  9. },
  10. "homeDir": "D:\\www\\xing\\ee",
  11. "root": "D:\\www\\xing\\ee",
  12. "appUserDataDir": "C:\\Users\\gaoshuaixing\\AppData\\Roaming\\ee",
  13. "userHome": "C:\\Users\\gaoshuaixing",
  14. "appVersion": "2.0.3",
  15. "isPackaged": false,
  16. "execDir": "D:\\www\\xing\\ee",
  17. "logger": {
  18. "dir": "D:\\www\\xing\\ee\\logs",
  19. "encoding": "utf8",
  20. "env": "local",
  21. "level": "INFO",
  22. "consoleLevel": "INFO",
  23. "disableConsoleAfterReady": false,
  24. "outputJSON": false,
  25. "buffer": true,
  26. "appLogName": "ee-2022-03-04.log",
  27. "coreLogName": "ee-core.log",
  28. "agentLogName": "ee-agent.log",
  29. "errorLogName": "ee-error-2022-03-04.log",
  30. "coreLogger": {},
  31. "allowDebugAtProd": false,
  32. "enablePerformanceTimer": false,
  33. "type": "application"
  34. },
  35. "httpclient": {
  36. "enableDNSCache": false,
  37. "dnsCacheLookupInterval": 10000,
  38. "dnsCacheMaxLength": 1000,
  39. "request": {
  40. "timeout": 5000
  41. },
  42. "httpAgent": {
  43. "keepAlive": true,
  44. "freeSocketTimeout": 4000,
  45. "maxSockets": 9007199254740991,
  46. "maxFreeSockets": 256
  47. },
  48. "httpsAgent": {
  49. "keepAlive": true,
  50. "freeSocketTimeout": 4000,
  51. "maxSockets": 9007199254740991,
  52. "maxFreeSockets": 256
  53. }
  54. },
  55. "socketServer": {
  56. "port": 7070,
  57. "isDynamic": false
  58. },
  59. "developmentMode": {
  60. "default": "vue",
  61. "mode": {
  62. "vue": {
  63. "hostname": "localhost",
  64. "port": 8080
  65. },
  66. "react": {
  67. "hostname": "localhost",
  68. "port": 3000
  69. },
  70. "html": {
  71. "hostname": "localhost",
  72. "indexPage": "index.html"
  73. }
  74. }
  75. },
  76. "openDevTools": false,
  77. "openAppMenu": true,
  78. "loadingPage": true,
  79. "windowsOption": {
  80. "width": 980,
  81. "height": 650,
  82. "minWidth": 800,
  83. "minHeight": 650,
  84. "webPreferences": {
  85. "contextIsolation": false,
  86. "nodeIntegration": true
  87. },
  88. "frame": true
  89. },
  90. "remoteUrl": {
  91. "enable": false,
  92. "url": "https://discuz.chat/"
  93. },
  94. "autoUpdate": {
  95. "windows": false,
  96. "macOS": false,
  97. "linux": false,
  98. "options": {
  99. "provider": "generic",
  100. "url": "http://kodo.qiniu.com/"
  101. },
  102. "force": false
  103. },
  104. "awakeProtocol": {
  105. "protocol": "ee",
  106. "args": []
  107. },
  108. "tray": {
  109. "title": "EE程序",
  110. "icon": "/public/images/tray_logo.png"
  111. },
  112. "testConfig": {
  113. "login": "http://local.com/api/login"
  114. },
  115. "coreMiddlewares": [],
  116. "coreMiddleware": [],
  117. "appMiddlewares": [],
  118. "appMiddleware": []
  119. }