Table of Contents

IHostBuilder.Configuration Method

Loads the configuration of the application from the sources that ASetup adds, instead of the conventional ones.

Remarks

Not needed for the conventional sources: hosted code reads TConfiguration.Current, which loads them by itself. This is for an application that wants others.

ASetup does not run here. It runs inside Run, before anything is started, and what it built then becomes TConfiguration.Current. A source that cannot be loaded therefore aborts the startup like any other failure, logged and with a non-zero exit code - which building the configuration in the program block, before the host exists, would not give.

Syntax

Unit: Sparkle.Host.Contracts

function IHostBuilder.Configuration(const ASetup: TProc<IConfigurationRoot>): IHostBuilder; virtual; abstract;

Parameters

<-> Parameter Type Description
const ASetup TProc<IConfigurationRoot> Receives an empty configuration and adds sources to it. It may read what it has already added - to fetch a secret from elsewhere and set it, for example.

See also