H.Necessaire Runtime Configuration Reference
How RuntimeConfig works and every configuration key the library reads, with defaults.
Applies to H.Necessaire 4.0.5.
H.Necessaire reads its settings from a RuntimeConfig: a tree of named nodes. This article explains how to provide one and lists the keys the library reads.
The config model
class ConfigNode
{
string ID { get; set; }
MultiType<string, ConfigNode[]> Value { get; set; } // a string, or child nodes
ConfigNode Get(string id);
ConfigNode[] GetAll();
string[] GetAllStrings();
}
class RuntimeConfig
{
ConfigNode Get(string id);
ConfigNode[] Values { get; set; }
}IDs are matched case-insensitively. A node's value is either a string or a list of child nodes, so QdActions.MaxProcessingAttempts in this article means the node MaxProcessingAttempts under the node QdActions.
Providing a config
The ConfigWith string extension builds nodes:
var config = new RuntimeConfig
{
Values = new[]
{
"App".ConfigWith(
"Name".ConfigWith("My App")
),
"QdActions".ConfigWith(
"ProcessingIntervalInSeconds".ConfigWith("5"),
"MaxProcessingAttempts".ConfigWith("5")
),
}
};
deps.Register<RuntimeConfig>(() => config);You can also implement ImAConfigProvider (RuntimeConfig GetRuntimeConfig()). With Integration.DotNet, IConfiguration (appsettings.json, environment variables and so on) is bridged into a provider for you. Code reads the result through dependencyProvider.GetRuntimeConfig(), which prefers a registered ImAConfigProvider, then a registered RuntimeConfig, then an empty config.
For secrets, ConfigWithSecretFromEmbeddedResources(secretName, assemblies) reads the value from an embedded resource instead of a string literal.
General
| Key | Default | Notes |
|---|---|---|
App.Name | "H.Necessaire" | Application name stamped on every log entry. |
DefaultHasher | SimpleSecureHasher | Also available: MD5Hasher; the runtime additionally registers RS512Hasher. |
Cryptography.AesKey | built-in default key | Base64 key for the default ImACryptographer. Set your own in any real deployment. |
Cryptography.CaesarCipherKey | built-in default key | Base64 key for the Caesar cipher cryptographer. |
CachingHousekeepingIntervalInSeconds | internal default | How often cache housekeeping runs. |
HttpBaseUrl, HttpApiBaseUrl | none | Base URLs used by the runtime's HTTP service. |
QD actions
| Key | Default |
|---|---|
QdActions.MaxProcessingAttempts | 3 |
QdActions.ProcessingIntervalInSeconds | 15 |
QdActions.ProcessingBatchSize | 10 |
File system and security
| Key | Default |
|---|---|
FileSystemStorageRootFolder | derived from the start assembly's folder |
IronMen.FilePath | ironmen.json |
IronMen.PassFilePath | ironmen.pass.json |
AppDataFolderPath | none; required by the SQLite data bin storage |
Storage providers
SQL (Dapper-based providers)
SqlConnections.DefaultConnectionStringSqlConnections.DatabaseNames.Core
RavenDB
RavenDbConnections.DatabaseNames.CoreRavenDbConnections.DatabaseUrls: a list of URLsRavenDbConnections.ClientCertificateName: the PFX certificate must be an embedded resourceRavenDbConnections.ClientCertificatePassword: if the certificate is password protectedRavenDbConnections.ColdArchiving: an optional node for the cold archiving store
Azure Cosmos DB
AzureCosmosDB.URLAzureCosmosDB.Keys: a listAzureCosmosDB.DatabaseIDAzureCosmosDB.ContainerID- Optional application name under
AzureCosmosDB.App,.Application,.AppNameor.ApplicationName
Google Firestore
Google.Firestore.ProjectIDGoogle.Firestore.HNecessaireDefault: optional collection name, defaulting toHNecessaireDefaultGoogle.Firestore.Auth.Json: path to the Google auth JSON, which you can skip ifGOOGLE_APPLICATION_CREDENTIALSis set
UI and CLI (from the project README)
These keys are documented in the repository README and weren't re-verified against the source for this article: BaseUrl, BaseApiUrl, SecurityContextCheckIntervalInSeconds (30), SyncIntervalInSeconds (10), the Formatting.* date and time patterns, Security.LoginUrl, Security.RefreshUrl, BffApiSyncRegistryRelativeUrl and the CLI's NuSpecRootFolderPath.