App Configuration¶
The main Electron process uses the config NPM module to load its configuration. See the Configuration Files guide on how to customize configuration for different deployments/environments.
The app configuration is currently fairly minimal, but allows controlling things like the application name and the release URL for portable Windows builds (that do not support auto update).
Customizing Config for Your App¶
To provide a custom app configuration, create a project with an electron-builder.yml and a default.json.
1 2 3 4 5 6 7 8 9 10 11 12 | appId: io.myopensphereapp
productName: My OpenSphere App
files:
- from: ../my-custom-electron-project
to: config
filter:
- 'default.json'
- src/**/*.js
- from: ../opensphere/dist/opensphere
to: opensphere
filter:
- '**/*'
|
The productName key will be used in creating the installer file names, and the files config will copy in the custom settings file along with code to run the app and the OpenSphere distribution. Paths are relative to the opensphere-electron directory. If you wish to change how platform-specific installers are built, see the Electron Builder documentation.
1 2 3 4 5 6 7 8 9 10 | {
"electron": {
"appName": "My OpenSphere App",
"releaseUrl": "https://myopensphereapp.io/releases/",
"webPreferences": {
"nodeIntegration": true,
"webSecurity": false
}
}
}
|
The electron.appName key will be used to replace the value returned by app.getName() in Electron, and the electron.releaseUrl will be launched if users wish to update a portable Windows build. Non-portable (installed) applications can be updated automatically by configuring Electron Builder’s auto update.
The webPreferences key modifies the object passed to the main BrowserWindow, changing how the window is created/configured. In the example, the following defaults are changed:
webSecurityis disabled to allow access to sites that do not support CORS.nodeIntegrationis enabled to provide a full Node environment to the application.
Both of these are discouraged by the Electron security tutorial, so be sure you fully understand the implications before changing settings like these.