How to specify Dapr component locations with Sidekick?

605 views Asked by At

I'm trying to get started with Sidekick for Dapr, and am having trouble telling Sidekick where the dapr components are.

By default it's going to %USERPROFILE%.dapr\components, but I'd rather it go to a folder local to the solution.

Looking at the code it appears that adding the following to the appsettings.json should work, but it isn't picked up.

 "DaprSidekick": {
    "RuntimeDirectory": "dapr",
    "ComponentsDirectory": "C:\\Dev\\DaprPOC\\components",
  }

However the components folder invariably becomes %USERPROFILE%\.dapr\components

Any help on how I specify the component locations with Sidekick?

2

There are 2 answers

0
Kudos On

You can also manually add the components directory in the dependency injection:

   services.AddDaprSidekick(configuration, p => p.Sidecar = 
        new DaprSidecarOptions() { AppId = "daprservice", ComponentsDirectory = "C:\\Dev\\DaprPOC\\components" });
0
Simon Jones On

When you set "RuntimeDirectory": "dapr" Sidekick will automatically look for component files in the dapr/components subdirectory in your solution. Try removing the ComponentsDirectory entry so it returns to defaults, and try a directory structure like this:

|-- MyProject
|   |-- MyProject.csproj
|   |-- dapr
|   |   |-- config.yaml
|   |   |-- components
|   |   |   |-- my_component.yaml

The Dapr Sidecar should then load my_component.yaml.