# CapturedEnvironmentVariable Properties

- Package: [Aspire.Hosting.Docker](/reference/api/csharp/aspire.hosting.docker.md)
- Type: [CapturedEnvironmentVariable](/reference/api/csharp/aspire.hosting.docker/capturedenvironmentvariable.md)
- Kind: `Properties`
- Members: `5`

Represents a captured environment variable that will be written to the .env file adjacent to the Docker Compose file.

## DefaultValue

- Name: `DefaultValue`
- Modifiers: `nullable` `get; set`
- Returns: `string?`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/5bd693ae1897dee5e2ce71c2cc08879c1c7eff51/src/Aspire.Hosting.Docker/CapturedEnvironmentVariable.cs)

Gets or sets the default value for the environment variable.

```csharp
public string? DefaultValue { get; set; }
```

## Description

- Name: `Description`
- Modifiers: `nullable` `get; set`
- Returns: `string?`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/5bd693ae1897dee5e2ce71c2cc08879c1c7eff51/src/Aspire.Hosting.Docker/CapturedEnvironmentVariable.cs)

Gets or sets the description for the environment variable.

```csharp
public string? Description { get; set; }
```

## Name

- Name: `Name`
- Modifiers: `get; init`
- Returns: `string`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/5bd693ae1897dee5e2ce71c2cc08879c1c7eff51/src/Aspire.Hosting.Docker/CapturedEnvironmentVariable.cs)

Gets the name of the environment variable.

```csharp
public string Name { get; init; }
```

## ATS metadata

### Ignored by ATS

- Excluded from automatic Polyglot export.

## Resource

- Name: `Resource`
- Modifiers: `nullable` `get; set`
- Returns: `IResource?`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/5bd693ae1897dee5e2ce71c2cc08879c1c7eff51/src/Aspire.Hosting.Docker/CapturedEnvironmentVariable.cs)

Gets or sets the resource that this environment variable is associated with. This is useful when the source is an annotation on a resource, allowing you to identify which resource this environment variable is related to.

```csharp
public IResource? Resource { get; set; }
```

## ATS metadata

### Ignored by ATS

- Excluded from automatic Polyglot export.

## Source

- Name: `Source`
- Modifiers: `nullable` `get; set`
- Returns: `object?`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/5bd693ae1897dee5e2ce71c2cc08879c1c7eff51/src/Aspire.Hosting.Docker/CapturedEnvironmentVariable.cs)

Gets or sets the source object that originated this environment variable. This could be a `ApplicationModel.ParameterResource`, `ApplicationModel.ContainerMountAnnotation`, `ApplicationModel.ContainerImageReference`, or `ApplicationModel.ContainerPortReference`.

```csharp
public object? Source { get; set; }
```
