Skip to content
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

Add more details about the GetEndpoint API #2233

Open
IEvangelist opened this issue Dec 4, 2024 · 1 comment
Open

Add more details about the GetEndpoint API #2233

IEvangelist opened this issue Dec 4, 2024 · 1 comment
Assignees
Labels
⌚ Not Triaged Not triaged

Comments

@IEvangelist
Copy link
Member

IEvangelist commented Dec 4, 2024

Make it easier for readers to understand that the GetEndpoint API can be used to splat env vars into a dependent resource, manually. Make it clear when this is required and why you'd want to do it.

Before

var quotes = builder.AddDockerfile("quotes", "../QuoteService")
                    .WithHttpEndpoint(port: 8082, targetPort: 8082)
                    .WithExternalHttpEndpoints();

var redis = builder.AddDockerfile("redis", "../", "Dockerfile.redis")
                   .WithEndpoint(port: 6379, targetPort: 6379, scheme: "tcp", isExternal: true);

builder.AddProject<Projects.Web("web")
       .WithEnvironment("REDIS", "localhost")
       .WithEnvironment("QUOTES_ENDPOINT", "https://localhost:8082")
       .WaitFor(quotes)
       .WaitFor(redis);

After

var quotes = builder.AddDockerfile("quotes", "../QuoteService")
                    .WithHttpEndpoint(port: 8082, targetPort: 8082)
                    .WithExternalHttpEndpoints();

var redis = builder.AddDockerfile("redis", "../", "Dockerfile.redis")
                   .WithEndpoint(port: 6379, targetPort: 6379, scheme: "tcp", isExternal: true);

builder.AddProject<Projects.Web("web")
       .WithEnvironment("REDIS", $"{redis.GetEndpoint("tcp").Property(EndpointProperty.Port)}")
       .WithEnvironment("QUOTES_ENDPOINT", quotes.GetEndpoint("http"))
       .WaitFor(quotes)
       
@IEvangelist IEvangelist self-assigned this Dec 4, 2024
@dotnetrepoman dotnetrepoman bot added the ⌚ Not Triaged Not triaged label Dec 4, 2024
@davidfowl
Copy link
Member

Feels like we should write a doc about how to use endpoint and reference expressions under the app host section. We have some of this content in writing a custom hosting integration. We can lift some of the content from there. It might be worth brain dumping some more ideas here so we can figure out where it goes.

cc @mitchdenny

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⌚ Not Triaged Not triaged
Projects
None yet
Development

No branches or pull requests

2 participants