# ProjectResource.WithEndpointsInEnvironment

- Module: [Aspire.Hosting](/reference/api/go/aspire.hosting.md)
- Defined on: [ProjectResource](/reference/api/go/aspire.hosting/projectresource.md)
- Version: `17.0.0`
- Kind: `method`

Includes only the specified project endpoint names in environment-variable injection.

## Definition

```go
type ProjectResource interface {
    // ... omitted for brevity
    WithEndpointsInEnvironment(endpointNames []string) ProjectResource
}
```

## Signature

```go
WithEndpointsInEnvironment(endpointNames []string) ProjectResource
```

## Parameters

- `endpointNames` (`[]string`) -- The endpoint names to include in environment variables.

## Returns

[`ProjectResource`](/reference/api/go/aspire.hosting/projectresource.md) -- The same project resource builder handle for chaining.

Returns a handle; failures surface later via `Err()`.

## Defined on

- [ProjectResource](/reference/api/go/aspire.hosting/projectresource.md) -- `handle`
