【问题标题】:How to specify Dapr component locations with Sidekick?How to specify Dapr component locations with Sidekick?
【发布时间】:2022-12-27 22:41:07
【问题描述】:

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?

【问题讨论】:

    标签: .net-6.0 dapr dapr-sidekick


    【解决方案1】:

    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.

    【讨论】:

      【解决方案2】:

      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" });
      

      【讨论】:

        猜你喜欢
        • 2022-12-02
        • 2022-12-02
        • 2022-09-14
        • 2022-12-27
        • 2022-12-27
        • 2017-05-03
        • 2022-12-27
        • 2022-12-28
        • 2022-12-02
        相关资源
        最近更新 更多