Base Config Files
bash
# Location
./electron/config/
# Description
config.default.js // Default config file, loaded in both development and production environments
config.local.js // Development environment config file, appends and overrides the default config file
config.prod.js // Production environment config file, appends and overrides the default config fileProperty Description
Developer Tools
javascript
openDevTools: boolean | object;
// Description
false, // false: disabled, true: enabled
{
mode: 'detach', // left, right, bottom, undocked, detach
activate: true, // Whether to bring the opened DevTools window to the foreground
title: '', // A title for the DevTools window (only in undocked or detach mode).
}Single Instance
javascript
singleLock = true; // Only one application instance can be openedMain Window
javascript
// For more properties, see documentation: https://www.electronjs.org/docs/latest/api/browser-window#new-browserwindowoptions
windowsOption = {
title: 'EE Framework', // Software top or top-left name (overridden by the title tag in html)
width: 980, // Software window width
height: 650, // Software window height
minWidth: 800, // Software window minimum width
minHeight: 650, // Software window minimum height
webPreferences: {
//webSecurity: false, // Uncomment if cross-origin access is needed
contextIsolation: false, // Set to false to use electron API in the renderer process
nodeIntegration: true, // Node modules
//preload: path.join(getBaseDir(), 'preload', 'bridge.js'),
},
frame: true,
show: true,
icon: path.join(getBaseDir(), 'public', 'images', 'logo-32.png'),
};Business Logs
javascript
logger = {
/** Log level: trace < debug < info < warn < error < fatal */
level: 'info',
/** Whether to use pretty format output in development environment */
prettyPrint: true,
/** Log file name date format */
dateFormat: 'yyyy-MM-dd',
/** Application log file name */
appLogName: 'ee.log',
/** Framework core log file name */
coreLogName: 'ee-core.log',
/** Error log file name */
errorLogName: 'ee-error.log',
/** Log rotation strategy: day (by day), hour (by hour) */
rotator: 'day',
/** Field paths to redact */
redact: [],
/** Redaction replacement value */
redactCensor: '[Redacted]',
/** Whether to include timestamp */
timestamp: true,
/** IANA timezone for log timestamps (JSON file logs); 'UTC' or e.g. 'Asia/Shanghai' */
timezone: 'UTC',
/** Pino logger name */
name: 'ee',
/** Maximum size of a single log file */
maxSize: '100m',
/** Pino serializers */
serializers: {},
/** Custom log levels */
customLevels: {},
/** Object serialization depth limit */
depthLimit: 5,
/** Safe mode: no exception thrown when log write fails */
safe: true,
}Remote Web URL
javascript
remoteUrl = {
enable: false, // Whether to enable
url: 'http://electron-egg.kaka996.com/' // Any web url
};Built-in Socket Service
javascript
# Third-party software can communicate with the ee framework by monitoring the port via socket-client
socketServer = {
enable: false, // Whether to enable
port: 7070, // Default port
isDynamic: false, // If false, the framework uses the default port (if the default port is in use, a random port is obtained); if true, the default port is invalid and the framework generates a random one
path: "/socket.io/", // Default path name
connectTimeout: 45000, // Client connection timeout
pingTimeout: 30000, // Heartbeat detection timeout
pingInterval: 25000, // Heartbeat detection interval
maxHttpBufferSize: 1e8, // Maximum data per message 1M
transports: ["polling", "websocket"], // HTTP polling and websocket
cors: {
origin: true, // Set to allow cross-origin when using HTTP protocol
},
channel: 'socket-channel' // Custom channel name, default socket-channel
};Built-in HTTP Service
javascript
# Can access the EE program from frontend, browser, or terminal commands
httpServer = {
enable: false, // Whether to enable
https: {
enable: false,
key: '/public/ssl/localhost+1.key', // key file
cert: '/public/ssl/localhost+1.pem' // cert file
},
host: '127.0.0.1',
port: 7071, // Default port (if port is in use, a random one is obtained)
cors: {
origin: "*" // Cross-origin
},
body: {
multipart: true,
formidable: {
keepExtensions: true
}
},
filterRequest: {
uris: [
'favicon.ico' // Request URIs to filter
],
returnData: '' // Any data type
}
};Main Process
javascript
mainServer = {
// Protocol: file://
protocol: 'file://',
// Frontend resource entry file
indexPath: '/public/dist/index.html',
// Compatible with electron parameters
// https://www.electronjs.org/docs/latest/api/browser-window#winloadurlurl-options
options: {},
// Load a loading page, generally not needed
loadingPage: '/public/html/loading.html',
// Takeover. If you want to load a go web program to replace the protocol
takeover: 'go',
channelSeparator: '/', // Communication channel path separator
};Cross-Language Services
Run executable programs of other languages.
javascript
cross = {
// Custom service name
go: {
// Whether to enable
enable: true,
// Executable program name
name: 'goapp',
// Arguments
args: ['--port=7073'],
// Whether to exit the entire desktop program when the executable exits
appExit: true,
}
};Exception Handling
Whether to exit after catching process exceptions.
javascript
exception = {
// Main process
mainExit: false,
// jobs child process
childExit: false,
};Jobs Tasks
javascript
jobs = {
// Whether to print/log inter-process communication messages
messageLog: true
};