Overriding settings from configuration
Any setting in relatude.db.json can be overridden from ASP.NET configuration. At startup the server
reads the RelatudeDB section and merges it over the file. The section can come from
appsettings.json, appsettings.{Environment}.json, environment variables, user secrets or any other
configuration source, and it has the same shape as relatude.db.json:
// appsettings.Development.json
{
"RelatudeDB": {
"MasterUserName": "admin",
"ContainerSettings": [
{ "LocalSettings": { "AutoBackUp": false } }
]
}
}The same keys work as environment variables (RelatudeDB__MasterPassword=…) and as user
secrets (dotnet user-secrets set RelatudeDB:TokenEncryptionSecret …). That is where credentials
belong: user secrets in development, environment variables or a vault in production, never
relatude.db.json.
How the section is merged:
- Objects merge key by key, and scalars replace. Keys are case-insensitive, and values are converted
to the setting's type (
"true","2.5", enum names). - List elements are matched on
Idwhen the section gives one, and on position otherwise. Elements that match nothing are added. - The section can change and add, but it cannot remove an element or set a value to null.
- A key that matches no setting, a read-only setting, or a value that does not parse is skipped with a warning in the startup log. A typo never stops the start.
- The startup log lists every overridden key path, never the values. Overriding an
IdorDefaultStoreIdchanges which object is meant, and logs a warning.
Values from configuration never reach a file. Before the admin UI saves, the server restores every overridden key to its value from the files, so a secret from configuration is never saved. The settings pages lock overridden keys.
The section is merged before OnServerSettingsInit runs, so every callback sees the merged settings.
ServerOptions.ConfigurationSectionName renames the section, and null turns it off.