-
Notifications
You must be signed in to change notification settings - Fork 770
Add a new Tls EndpointProperty #13778
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 13778Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 13778" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR introduces a new Tls property to the EndpointProperty enum, enabling resolution of TLS status via ReferenceExpression. The implementation automatically defaults to true for HTTPS endpoints while allowing explicit TLS configuration for non-HTTP TCP endpoints (like Redis with TLS).
Key changes:
- Added
Tlsproperty toEndpointAnnotationthat defaults totruefor HTTPS scheme - Added
Tlsenum value toEndpointPropertyfor reference resolution - Refactored Redis connection string and URI building to use the new
EndpointProperty.Tls
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
src/Aspire.Hosting/ApplicationModel/EndpointAnnotation.cs |
Adds new Tls property with smart defaulting based on URI scheme (HTTPS = true) |
src/Aspire.Hosting/ApplicationModel/EndpointReference.cs |
Adds Tls property to EndpointReference, adds Tls enum value to EndpointProperty, implements expression resolution for TLS status returning "true"/"false" strings |
src/Aspire.Hosting.Redis/RedisResource.cs |
Refactors connection string building to use EndpointProperty.Tls instead of TlsEnabled flag, simplifies URI expression using PrimaryEndpoint.Scheme |
src/Aspire.Hosting.Redis/RedisBuilderExtensions.cs |
Adds explicit scheme configuration for Redis endpoints and sets Tls = true on primary endpoint when TLS certificate is configured |
Description
Introduce a new
TlsEndpointPropertyto enable resolving whether an endpoint is TLS enabled viaReferenceExpression(resolves totrueorfalsedepending on whether an endpoint is TLS enabled). HTTPS endpoints are automatically considered TLS enabled, while non-HTTP TCP endpoints require TLS to be explicitly enabled on the endpoint.This is a bit of a brute force approach, but several different connection strings need a boolean value to indicate whether a connection uses TLS or not, but there's currently timing issues where we may not know if an endpoint is actually TLS terminated when a connection string is requested. We need some kind of value provider to correctly populate connection strings in these cases.
I also took the opportunity to update the redis connection string to use
redisandredissschemes instead oftcpto make generating URI style connection strings more straightforward.Fixes #13645