-
I need to set two environment variables for a project to be able to run correctly: one is the address of another service, the other is the address of the same service. var auth = builder.AddProject<AuthService>("auth")
.WithReference(db)
.WithReference(legacyDb);
var admin = builder.AddProject<Admin>("admin")
.WithEnvironment("AdminUi__AuthorityUrl", auth.GetEndpoint("http"))
.WithEnvironment("AdminUi__UiUrl", "http://localhost:5278") // Copied from launchSettings.json
.WithReference(db); Is there a better way than this? Something that doesn't create a magic string coupling? Ideally I'd love the possibility to do something like var admin = builder.AddProject<Admin>("admin")
.WithEnvironment("AdminUi__AuthorityUrl", auth.GetEndpoint("http"))
.WithEnvironment("AdminUi__UiUrl", t => t.GetEndpoint("http"))
.WithReference(db); |
Beta Was this translation helpful? Give feedback.
Answered by
davidfowl
Apr 10, 2024
Replies: 1 comment 1 reply
-
We might need a new API to make this pleasant. Right now you would need to do something wacky like: EndpointReference adminHttp = default!;
var admin = builder.AddProject<Admin>("admin")
.WithEnvironment("AdminUi__AuthorityUrl", auth.GetEndpoint("http"))
.WithEnvironment(context => context.EnvironmentVariables["AdminUi__UiUrl"] = adminHttp)
.WithReference(db);
adminHttp = admind.GetEndpoint("http"); |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
Kralizek
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We might need a new API to make this pleasant. Right now you would need to do something wacky like: