Replies: 2 comments
-
If the .WithDaprSidecar(daprBuilder =>
{
daprBuilder.WithOptions(daprOptions);
daprBuilder.WithEnvironment("APP_API_TOKEN", daprApiToken);
} But with the current version (9.7.0) of the CommunityToolkit.Aspire.Hosting.Dapr, the above code does not compile. As a workaround, you can set the environment variable via an I am using this extension method: public static class DaprExtensions
{
/// <summary>
/// Adds a Dapr sidecar with the specified options and an APP_API_TOKEN environment variable
/// </summary>
public static IResourceBuilder<ProjectResource> WithDaprSidecarAndToken(
this IResourceBuilder<ProjectResource> builder,
DaprSidecarOptions daprOptions,
string daprApiToken = "dev-secret-token")
{
return builder
.WithEnvironment("APP_API_TOKEN", daprApiToken)
.WithDaprSidecar(daprBuilder =>
{
daprBuilder.WithOptions(daprOptions);
// Direct annotation approach - works with any IResource
daprBuilder.Resource.Annotations.Add(new EnvironmentCallbackAnnotation((envVars) =>
{
envVars["APP_API_TOKEN"] = daprApiToken;
}));
});
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
-
The dapr resource has moved to the community toolikit https://github.com/CommunityToolkit/Aspire/issues |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I'm trying to set the APP_API_TOKEN Dapr environment variable to a specific value, but I couldn't find a way to do that using the x.WithDaprSidecar("app-id", new DaprSidecarOptions { }) builder method. I suspect I might be missing something obvious.
By the way, I'm using Aspire locally only, if that matters.
Beta Was this translation helpful? Give feedback.
All reactions