Configuration and databases
On this page
Configuration loading
The sample uses ConfigurationScanDirectories in appsettings.json to scan Configuration. Admin.json contains host, JWT and bootstrap options; Database.json contains connections. TUtility.App controls environment and command-line precedence.
This custom-host configuration lists only the Default connection; see the table below for logging connections. ${...} placeholders apply only to settings that support environment-variable resolution.
{
"JwtOptions": {
"Issuer": "MyHost",
"Secret": "${TADMIN_JWT_SECRET}",
"ExpiredTime": 10,
"Algorithm": "HS256",
"Type": "JWT"
},
"OrmOptions": [
{
"ConfigId": "Default",
"DatabaseType": "Sqlite",
"ConnectionString": "Data Source=DB/Admin.db",
"CommandTimeout": 30
}
],
"AdminBootstrapOptions": {
"UserName": "admin",
"Password": "${TADMIN_BOOTSTRAP_PASSWORD}",
"RequirePasswordChange": true,
"AllowInsecureBootstrapPassword": false
},
"SeedDataOptions": { "ForceUpdate": false, "ForceUpdateUsers": false },
"AdminNetworkOptions": { "TrustedProxies": [] }
}Set the referenced environment variables before startup. The standalone sample uses its own local configuration; see quick start.
| Option | Meaning and integration point |
|---|---|
WebApiOptions.ListenAddress | HTTP listener; the sample uses 127.0.0.1:6200, which is separate from a deployed public URL |
JwtOptions.ExpiredTime | Access-token lifetime in minutes |
JwtOptions.Issuer / Secret | Signing and validation must agree; changing them may invalidate existing tokens |
AdminBootstrapOptions | Initial account and password-change policy for an empty database |
SeedDataOptions.ForceUpdate / ForceUpdateUsers | Seed and user update choices; adding one module does not require enabling both indiscriminately |
ConfigurationScanDirectories | Extra configuration loading, configured in the host’s appsettings.json |
The standalone sample uses admin / 111111 locally, with RequirePasswordChange = false, AllowInsecureBootstrapPassword = true, and both force-update options set to false.
Database connections
ConfigId | Purpose |
|---|---|
Default | Administration data |
Operate | Operation logs |
Backend | Backend logs |
SqlLog | SQL logs |
TORM consumes OrmOptions; match the database type to its connection string. See host extensions for realm-to-tenant connection resolution.
Modules look up connections by ConfigId; configure the corresponding entries for each enabled logging module. SQLite relative paths resolve from the process working directory.
Diagnose configuration that appears ineffective
| Symptom | Check in order |
|---|---|
| A changed file has no effect | Actual startup directory, scanned configuration paths, environment and command-line overrides |
| Records appear in an unexpected database | ConfigId, provider, connection string and SQLite path, beyond just the filename |
| Administration works but logging fails | Connections and initialization for Backend, Operate and SqlLog individually |
| Tokens expire early or existing tokens fail | Minute units, signing/validation agreement and recent Issuer / Secret changes |
| A placeholder remains literal | Whether that option supports placeholder resolution; arbitrary JSON fields do not interpolate automatically |
Secret protection
AdminSecretProtectionOptions contains KeyId and a Base64-encoded, 32-byte MasterKey. The default setting can resolve TADMIN_SECRET_PROTECTION_KEY. Without an external value, the current implementation uses a built-in default. Production hosts should own a random key and supply the same key to instances sharing a database.
Persist key material alongside a suitable recovery plan for the encrypted database data. Replacing the key without re-encryption makes existing ciphertext unreadable.
Capacity and multiple instances
OneTimeCodeStoreOptions, AdminRateLimitOptions and AdminStateCacheOptions configure short-lived state, throttling and caches. PasswordPolicyOptions configures passwords. Default local implementations provide consistency within one process.
Multiple instances require a shared atomic IOneTimeCodeStore, an atomic IAdminRateLimiter and cross-instance permission/session invalidation, all using consistent realm keys.
Populate TrustedProxies with the direct IP addresses of controlled proxies. Untrusted forwarding headers must not determine the public scheme or trusted origin.