man-group / dapr-sidekick-dotnet

Dapr Sidekick for .NET - a lightweight lifetime management component for Dapr
Apache License 2.0
175 stars 21 forks source link

Help? #45

Closed BinaryWorrier closed 2 years ago

BinaryWorrier commented 2 years ago

Where does one go for help on Sidekick? There are no active questions on Stackoverflow, is there are Usergroup or other where questions can be asked and the good folks who build Sidekick hang out to help us plebs out?

Thanks.

badgeratu commented 2 years ago

You're in the right place, we tend to use Issues for conversations and have the "Discussion" issue type for that purpose. Sidekick is fairly feature rich though and generally does what many need it to OOB so we don't have that many questions. Always welcome them though - what would you like help with?

BinaryWorrier commented 2 years ago

OK, thanks.

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

This is from this Stack overflow question https://stackoverflow.com/questions/72530687/how-to-specify-dapr-component-locations-with-sidekick

badgeratu commented 2 years ago

As you asked the question on StackOverflow as well I've answered it there,, but here's a copy:

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.

BinaryWorrier commented 2 years ago

Simon, I'm replying here because it allows a better "conversation" as it were 😊 Also, thank you for your time and help, it's appreciated.

OK, so I set up my folder structure as above, still no joy.

This is what I have for sidekick in my appsettings.json. "DaprSidekick": { "RuntimeDirectory": "dapr" }

I've created a minimal sample that reproduces my problem, you can find it here. https://github.com/BinaryWorrier/DaprNoddy

badgeratu commented 2 years ago

The problem is this line in your Program.cs:

builder.Services.AddDaprSidekick();

The samples and README instructions all pass the IConfiguration instance to that extension method which gives it access to all the configuration settings, including those in appsettings.json. Without that it won't know what you've defined as preferences :)

Try changing it to this:

builder.Services.AddDaprSidekick(builder.Configuration);
BinaryWorrier commented 2 years ago

D'oh! 🙄

Thanks!