# CapturedEnvironmentVariable

- Kind: `class`
- Package: [Aspire.Hosting.Docker](/reference/api/csharp/aspire.hosting.docker.md)
- Version: `13.3.0`
- Namespace: `Aspire.Hosting.Docker`
- Target framework: `net8.0`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/5bd693ae1897dee5e2ce71c2cc08879c1c7eff51/src/Aspire.Hosting.Docker/CapturedEnvironmentVariable.cs)

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

## Definition

```csharp
namespace Aspire.Hosting.Docker;

public sealed class CapturedEnvironmentVariable
{
    // ...
}
```

## ATS metadata

### ATS export

- Type ID: `Aspire.Hosting.Docker/CapturedEnvironmentVariable`

## Constructors

- [CapturedEnvironmentVariable](/reference/api/csharp/aspire.hosting.docker/capturedenvironmentvariable/constructors.md#constructor)

## Properties

- [DefaultValue](/reference/api/csharp/aspire.hosting.docker/capturedenvironmentvariable/properties.md#defaultvalue) : `string?` `get; set` -- Gets or sets the default value for the environment variable.
- [Description](/reference/api/csharp/aspire.hosting.docker/capturedenvironmentvariable/properties.md#description) : `string?` `get; set` -- Gets or sets the description for the environment variable.
- [Name](/reference/api/csharp/aspire.hosting.docker/capturedenvironmentvariable/properties.md#name) : `string` `get; init` `ats ignored` -- Gets the name of the environment variable.
- [Resource](/reference/api/csharp/aspire.hosting.docker/capturedenvironmentvariable/properties.md#resource) : `IResource?` `get; set` `ats ignored` -- 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.
- [Source](/reference/api/csharp/aspire.hosting.docker/capturedenvironmentvariable/properties.md#source) : `object?` `get; set` -- Gets or sets the source object that originated this environment variable. This could be a `ApplicationModel.ParameterResource`, `ApplicationModel.ContainerMountAnnotation`, `ApplicationModel.ContainerImageReference`, or `ApplicationModel.ContainerPortReference`.
