# EndpointReference.GetTlsValue

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

Gets a conditional expression that resolves to the enabledValue when TLS is enabled on the endpoint, or to the disabledValue otherwise.

## Remarks

The returned expression evaluates the TLS state lazily each time its value is resolved, making it
safe to embed in a `ReferenceExpression` that is built before TLS is configured
(e.g., before `BeforeStartEvent` fires). Because the condition and branches are declarative,
polyglot code generators can translate this into native conditional constructs in any target language.

## Definition

```go
type EndpointReference interface {
    // ... omitted for brevity
    GetTlsValue(
        enabledValue *ReferenceExpression,
        disabledValue *ReferenceExpression,
    ) *ReferenceExpression
}
```

## Signature

```go
GetTlsValue(
    enabledValue *ReferenceExpression,
    disabledValue *ReferenceExpression,
) *ReferenceExpression
```

## Parameters

- `enabledValue` (`*ReferenceExpression`) -- The expression to evaluate when TLS is enabled (e.g., `",ssl=true"`).
- `disabledValue` (`*ReferenceExpression`) -- The expression to evaluate when TLS is not enabled.

## Returns

`*ReferenceExpression` -- A conditional `ReferenceExpression` whose value tracks the TLS state of this endpoint.

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

## Defined on

- [EndpointReference](/reference/api/go/aspire.hosting/endpointreference.md) -- `handle`
