How can I get the environment variables in my custom resource. #11825
Answered
by
davidfowl
WhiteOlivierus
asked this question in
Q&A
-
I need to be able to access the environment variables and endpoints passed with with reference and with environment in my resource during the build. Is this possible? And how. Right now nothing is passed to my resource. |
Beta Was this translation helpful? Give feedback.
Answered by
davidfowl
Oct 6, 2025
Replies: 2 comments 6 replies
-
Hello @WhiteOlivierus, myResource.WithEnvironment(ctx =>
{
var url = ctx.GetEndpoint("service")?.Url;
ctx.EnvironmentVariables["VAR"] = url ?? "";
}); |
Beta Was this translation helpful? Give feedback.
0 replies
-
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This class handles executables, projects and containers https://github.com/dotnet/aspire/blob/dca8a6ddcd4a91ad4ff52f2cd46fb3d7a8a5ac5a/src/Aspire.Hosting/Dcp/DcpExecutor.cs