Purpose
Configuration lets you change how a product behaves without altering the product itself. A product reads its configuration once, when the resource starts, and uses those values until it is restarted. Configuration files live in theconfigs directory of the product’s resource:
Options
File format
Files use the.jsonc extension: JSON that also accepts comments. Both comment styles work.
values; leave the other three
as they are. scope records which side of the server the settings belong to and is explained under
Client and server settings.
None of the three is a switch. The file is found by its filename, and the release decides which
side owns the namespace, so changing namespace or scope moves nothing. Because that would
otherwise be a change with no effect and no sign of it, either one produces a warning naming the file:
You only need the keys you change
Any key you leave out keeps the value the product shipped. This applies at every level, so you can remove a whole section and keep only the setting you care about:blips setting keeps its shipped value.
Two consequences worth knowing:
- A key set to
nullis treated as if it were absent, so the shipped value is used. To turn a feature off, set it tofalserather thannull. - A key the product does not recognise is ignored. A misspelled key name produces no error and no effect: the product goes on using the shipped value. If an edit appears to do nothing, check the spelling against the product’s configuration page first.
Values are not checked
Your values are passed to the product as you wrote them. There is no check that a number is within a sensible range, or that a value has the type the product expects. A string where a number belongs does not produce a startup error; it produces incorrect behaviour later, in the part of the product that reads it. Each product’s configuration pages list the accepted values and the bounds worth respecting for every key. Stay inside them.Client and server settings
Each namespace belongs to one side of the server. The release decides which; the file’sscope field
records it so you can see it without looking anything up:
You edit all three the same way. The distinction matters when a setting holds something private.
Example
A complete edited file, with a comment recording why the change was made:A file that does not work
Applying changes
Configuration is read when the resource starts. An edit takes effect at the next start of that resource, and at no other moment. Nothing reloads on its own.Safety
Your edits are replaced by an update
Keep your edited files somewhere outside the resource directory (ideally in your own version control) and put them back after each update. Update a product or the SDK describes the procedure step by step.An older file is upgraded at start
configVersion records the shape of a namespace. When a product release changes that shape, it
raises the number and carries the instructions to convert an older file.
If you restore a configuration file from a previous version of the product, it is converted in
memory at start and the conversion is reported:
Recovering from a broken file
Restore the file from the release, restart, confirm the warning is gone, then reapply your changes one key at a time. Restarting after each key tells you which one caused the problem.Related
- Languages and text: the locale files, which follow the same rules
- Update a product or the SDK
- Configuration changes have no effect
- What is inside a product resource