Closed bit365 closed 10 months ago
The WithEnvironment()
applies to the project resource and not the sidecar. That is, WithEnvironment()
returns the original project resource builder; the sidecar is not a resource in its own right. My first thought is that the DaprSidecarOptions
should have an Environment
property on which to set sidecar-specific variables. This would be similar to how Dapr run files work.
An argument could be made that the sidecar should itself be a resource that is simply referenced by the project resource, in which case it could then use common resource annotations (such as WithEnvironment()
). It wasn't modeled that way originally because of the tight 1:1 relationship between a sidecar and a project. If it were a resource, the sidecar could end up referenced by multiple resources, which would be semantically invalid.
We need to have this functionality and I agree having the SideCar has a resource will be more consistent. The reason why environment must be supported is to support the https://docs.dapr.io/reference/components-reference/supported-secret-stores/envvar-secret-store/ scenario.
I need to reference an environment variable in Dapr's component configuration file, but after using the following code, I cannot get the variable in the dapr sidecar.
For example, the secretstores.local.env component in dapr obtains values from environment variables.
Unable to extract value from testtesttesttesttesttesttest