string Environment { get; }
The current environment name. Read from "ASPNETCORE_ENVIRONMENT" or "DOTNET_ENVIRONMENT" environment variables, defaults to "Production" if neither is set.
A basic implementation of IRunnableHostModule that does nothing. This is useful for providing implementations of apps that do not require a module.
void ConfigureServices(StartupContext context, IServiceCollection services)
Configures services for the module. This implementation is empty.
contextThe startup context.servicesThe service collection.void RegisterDependentModules(ModuleDependencyBuilder builder)
Registers dependent modules. This implementation is empty.
builderThe module dependency builder.void ConfigureHostBeforeServices(StartupContext context, IHostBuilder builder)
Configures the host before services are registered. This implementation is empty.
contextThe startup context.builderThe host builder.void ConfigureHostAfterServices(StartupContext context, IHostBuilder builder)
Configures the host after services are registered. This implementation is empty.
contextThe startup context.builderThe host builder.Default implementation of IEnvironmentProvider that retrieves the environment from system environment variables. It checks for "ASPNETCORE_ENVIRONMENT" first, then "DOTNET_ENVIRONMENT", and defaults to "Production" if neither is set. Can be overridden by passing a custom implementation to the StartupContext, when building the host.
string? GetEnvironmentVariable(string name, string? defaultValue = null)
Gets the value of an environment variable from the system.
nameThe name of the environment variable.defaultValueThe default value to return if the environment variable is null or empty.The environment variable value or the provided default if the variable is null or empty.
string Environment { get; }
The current environment name. Read from "ASPNETCORE_ENVIRONMENT" or "DOTNET_ENVIRONMENT" environment variables, defaults to "Production" if neither is set.
bool IsDevelopment { get; }
True if the current environment is "Development".
Internal Services Registration