Configuration lifecycle
The configuration lifecycle turns built-in settings and user policy into the runtime configuration used by the application. It loads system and user files, combines them with command-line and environment input, checks the result, reports safe warnings, supports old option names during migration, and applies changes either at startup or while the app runs. This page complements Configuration and customization; feature-specific settings are described in Custom user experience and Enterprise device management.
Configuration sources
Source precedence
The application starts with its built-in option defaults. It then reads the system file at etc/…/config.json when present and the user config.json in the application configuration directory. The user file overrides matching system values, which lets device managers set policy while still allowing user-level choices where the two do not conflict. Command-line and environment input are parsed with the file result and can provide launch-specific overrides.
When no usable file is found, the application continues with defaults. A system-file read error is ignored with a warning. A user-file read error is recorded and the app falls back to the system settings or defaults instead of stopping startup.
References: app/…/index.js• L14-20 app/…/index.js• L38-91 app/…/index.js• L94-105
Configuration schema
The option definitions are the contract for supported settings. Each option describes its default value, data type, user-facing description, allowed choices when needed, and whether a change is live or needs a restart. Object options also describe the types of supported nested leaves. The same definitions drive runtime parsing and generated configuration documentation, so a schema change must keep those views aligned.
The schema uses nested groups for new settings, such as app, window, appearance, tray, and performance. Older flat names remain in the schema only while their rename window is open. See the Configuration Options Reference for the complete option list rather than treating this page as an option catalog.
References: app/…/options.js• L1-24 app/…/options.js• L30-74 app/…/options.js• L1183-1432
Startup processing
Startup sequence
Startup processing resolves the file sources before it parses the final option set. It then projects supported nested names onto the keys that current feature code reads, initializes logging, reports deprecations, validates file content, and returns the startup configuration to the application.
The sequence below shows how input becomes the configuration used by the main process and browser windows.
flowchart TD
A[Built-in defaults] --> C[System config]
B[User config] --> C
C --> D[Merge with user precedence]
D --> E[Command line and environment parsing]
E --> F[Deprecated-name projection]
F --> G[Logger initialization]
G --> H[Deprecation and schema warnings]
H --> I[Startup configuration]
I --> J[Main process and renderer]
References: app/…/index.js• L38-105 app/…/index.js• L132-200 app/…/index.js• L16-49
Runtime configuration
AppConfiguration keeps the resolved startup configuration with the configuration directory and the persistent stores used by the app. Most settings are read once and therefore take effect after a relaunch. Settings marked live can be changed during a session through the app menus; the main process updates its current values and sends a small change set to the renderer.
Watching the config file is a separate development feature. When enabled, a file change asks the app to restart so that startup-only settings are read again. It does not make every option live.
References: app/…/index.js• L11-58 app/…/options.js• L9-15 app/…/index.js• L154-160 app/…/index.js• L499-525 app/index.js• L219-224
Validation and feedback
Schema validation
Validation checks the user-provided merged file against the option schema after logging is ready. It reports unknown keys, wrong types, invalid choices, and invalid nested leaves. Validation is warn-only: it never blocks startup, exits the app, or changes the value resolution by itself.
The validator treats null as an unset value and supports declared union types such as a log level or false. It limits nested traversal and suppresses configured values from warnings, which prevents URLs, tokens, email addresses, and other private data from entering diagnostic output.
References: app/…/validator.js• L1-8 app/…/validator.js• L16-38 app/…/validator.js• L69-139 app/…/index.js• L184-195
Configuration logging
Logging is configured before validation and deprecation warnings run. The logConfig setting controls the console and file transports; file logging is disabled by default, while a false configuration disables the logger. Log data passes through a sanitizing hook before it reaches the transports.
Warnings identify option names, expected types, and allowed choices rather than values. This keeps configuration diagnosis useful without making logs a second copy of secrets or private account data.
References: app/…/logger.js• L1-3 app/…/logger.js• L22-62 app/…/index.js• L174-195
Option evolution
Deprecated names
The configuration model is moving from flat top-level names to grouped nested names. Both names work during the deprecation window, but new files should use the nested name. If both names are present in a config file, the nested name is canonical and supplies the value used at runtime. The current transition keeps old names working until version 2.30.0.
Nested names are supported in configuration files during this transition. Command-line flags and environment variables continue to use the flat option names; a nested command-line spelling is not projected into the runtime keys.
References: app/…/renames.js• L1-19 app/…/renames.js• L139-164 docs-site/…/configuration.md• L96-112
Deprecation warnings
At startup the app creates one warning for all deprecated names found in the merged config file. The warning gives the replacement name and does not include the configured value. It is written to the log instead of opening a blocking startup dialog, because common renamed options could otherwise interrupt many launches.
When a Settings menu is reachable, the warning points to Settings > Show Updated Config…. No pointer is shown when both the menu bar and tray menu are unavailable. The warning currently checks config-file use only, so deprecated command-line or environment input does not receive the same notice.
References: app/…/deprecation.js• L1-16 app/…/deprecation.js• L18-53 app/…/deprecation.js• L56-72 app/…/index.js• L108-129
File migration
Migration copy
The migration action creates config.migrated.json beside the user’s config.json. It rewrites recognized flat names to nested names while preserving unrelated settings, leaves the original file untouched, and lets the user review the copy before replacing the active file. It reads only the user file, not the merged system-and-user view, so administrative settings are not copied into a user override.
The copy keeps the original file’s permissions, or uses owner-only permissions when the original cannot be inspected. The result reports option names and validation warnings but does not return configured values. If a target namespace is not an object, that rename is left in place and reported as skipped.
References: app/…/migrateFile.js• L1-24 app/…/migrateFile.js• L27-37 app/…/migrateFile.js• L39-109
Migration review
The Settings action presents the migration result as an informational, warning, or error message. It explains whether there is no file, no work, invalid JSON, a blocked namespace, or a write failure. After a successful write, the user can open the generated copy and must rename it over config.json when the review is complete.
Migration validates the generated file because a flat option can receive parser coercion that a nested leaf does not. For example, an array-valued flat option can accept one scalar and become a one-item list, while the migrated nested value needs explicit checking.
References: app/…/appMenu.js• L103-135 app/…/index.js• L371-449 app/…/migrateFile.js• L78-109
Configuration contracts
Rename contracts
The rename table connects each deprecated flat option to one declared nested target. It also records special conversions. Array values are wrapped when the nested form receives a scalar, and inverted booleans are negated so a setting such as “disable notifications” keeps its meaning as an “enabled” setting.
The nested value is projected only when that path is present in the raw config file. This presence check distinguishes an explicit user choice from a value supplied only by defaults. The same precedence and conversion rules are used when creating a migration copy.
References: app/…/renames.js• L21-108 app/…/renames.js• L120-163 app/…/renames.js• L231-287
Runtime change contracts
Live changes use a named delta sent from the main process to the renderer. The renderer applies each changed key to its current configuration, while components that need special handling can react to the delta itself. Startup-only changes do not use this path; they require a restart or the config-file watcher.
This split matters when adding an option. Marking an option live without a working re-read and notification path creates a setting that appears changed but does not affect all consumers.
References: app/…/options.js• L9-15 app/…/index.js• L515-525 app/…/preload.js• L479-484 app/…/trayIconRenderer.js• L21-33
Change checklist
When these files or sections are changed, remember to consider these:
- Update the option definition, generated configuration reference, and schema artifact together when an option’s name, type, default, choices, nested fields, or apply mode changes.
- Keep the deprecation text, rename table, runtime projection, and migration transform aligned for every flat-to-nested rename.
- Preserve nested-name precedence and presence-based projection when changing default merging or parser behavior.
- Check both user-file and system-file behavior when changing file loading or migration. Migration must not turn system policy into a user override.
- Keep validation and user-facing migration results free of configured values, including parse and filesystem errors that may contain source text or paths.
- Add a runtime change delta and consumer handling before assigning
liveapply mode to a new setting. - Keep the config-file watcher tied to restart behavior rather than treating it as a general live reload mechanism.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| A user config contains invalid JSON | User settings are not loaded; the app falls back to system settings or defaults and records the error | Fix the file; startup does not stop on the parse error |
| A config key or nested leaf is unknown | The setting is ignored while the app continues with its resolved value | Read the [CONFIG] warning and compare the key with the current schema |
| A setting has the wrong type or choice | The file is accepted but the bad entry may not control the feature as intended | Use the expected type and allowed choice shown by validation |
| Both old and new names are set | The nested name wins, which can hide a conflicting old value | Remove the old name after reviewing the nested setting |
| A rename target is occupied by a scalar | Automatic migration leaves that old key unchanged and does not write a misleading copy | Change the namespace to an object, then run migration again |
| A config file changes while only restart-mode settings are in use | The running app keeps its current settings until restart | Use the watcher for a deliberate restart or relaunch the app |
| Deprecated names are supplied only through CLI or environment input | The old spelling may work without a deprecation warning | Move launch settings to the nested file form or use the current supported flat input |
Key files
| File | Why to read it |
|---|---|
| app/…/index.js | Main startup flow for source loading, parsing, rename projection, logging, validation, and file watching |
| app/…/options.js | Single schema for defaults, types, nested fields, choices, deprecation text, and apply modes |
| app/…/renames.js | Compatibility rules for old names, precedence, value conversion, and migration transforms |
| app/…/validator.js | Warn-only checks for top-level and nested config data, including privacy-safe warning rules |
| app/…/migrateFile.js | Safe creation of the reviewed config.migrated.json copy |
| app/…/deprecation.js | Aggregated startup warning and menu-availability decision |
| app/…/logger.js | Log transport setup and sanitization hook used before configuration warnings are emitted |
| app/…/index.js | Runtime holder that exposes the resolved startup configuration and persistent stores |
| app/…/index.js | User-facing migration action and live setting changes sent to the renderer |
| app/…/preload.js | Renderer-side application of live configuration deltas |