Method AddDotEnv
| Improve this Doc View SourceAddDotEnv(IServiceCollection)
Adds the environment vars using a service. This registers IEnvReader as a singleton and calls the Load() method.
Declaration
public static IEnvReader AddDotEnv(this IServiceCollection services)
Parameters
Type | Name | Description |
---|---|---|
IServiceCollection | services | The service collection. |
Returns
Type | Description |
---|---|
IEnvReader | An instance that allows access to the environment variables. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
AddDotEnv(IServiceCollection, String[])
Adds the environment vars using a service. This registers IEnvReader as a singleton and calls the Load() method.
Declaration
public static IEnvReader AddDotEnv(this IServiceCollection services, params string[] paths)
Parameters
Type | Name | Description |
---|---|---|
IServiceCollection | services | The service collection. |
String[] | paths | The .env files paths to add. |
Returns
Type | Description |
---|---|
IEnvReader | An instance that allows access to the environment variables. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
ArgumentException | The length of the |
AddDotEnv<TSettings>(IServiceCollection)
Adds the environment vars using a service.
This registers TSettings
as a singleton and calls the Load() method.
Declaration
public static TSettings AddDotEnv<TSettings>(this IServiceCollection services)
where TSettings : class, new()
Parameters
Type | Name | Description |
---|---|---|
IServiceCollection | services | The service collection. |
Returns
Type | Description |
---|---|
TSettings | An instance that allows access to the environment variables. |
Type Parameters
Name | Description |
---|---|
TSettings | The type of the new instance to bind. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
AddDotEnv<TSettings>(IServiceCollection, String[])
Adds the environment vars using a service.
This registers TSettings
as a singleton and calls the Load() method.
Declaration
public static TSettings AddDotEnv<TSettings>(this IServiceCollection services, params string[] paths)
where TSettings : class, new()
Parameters
Type | Name | Description |
---|---|---|
IServiceCollection | services | The service collection. |
String[] | paths | The .env files paths to add. |
Returns
Type | Description |
---|---|
TSettings | An instance that allows access to the environment variables. |
Type Parameters
Name | Description |
---|---|
TSettings | The type of the new instance to bind. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
ArgumentException | The length of the |