Share via


Service.AddEnvironmentalVariable(String, String) Method

Definition

Adds an environmental variable to the service's environment dictionary. If the specified value is null, it assigns an empty string as the value.

public Aspire.Hosting.Docker.Resources.ComposeNodes.Service AddEnvironmentalVariable(string key, string? value);
member this.AddEnvironmentalVariable : string * string -> Aspire.Hosting.Docker.Resources.ComposeNodes.Service
Public Function AddEnvironmentalVariable (key As String, value As String) As Service

Parameters

key
String

The key for the environmental variable.

value
String

The value of the environmental variable. If null, an empty string will be used.

Returns

The updated Service instance with the added environmental variable.

Applies to