masastack / MASA.Utils

MIT License
71 stars 19 forks source link

When Caller.Dapr is used in the same cluster, projects in different environments will string together. #60

Closed zhenlei520 closed 2 years ago

zhenlei520 commented 2 years ago

When deploying projects in two environments in the same cluster, the project calls are confusing. It is recommended to customize CustomizeDaprCallerBase and change the custom Caller to inherit CustomizeDaprCallerBase

public abstract class CustomizeDaprCallerBase : DaprCallerBase
{
    protected CustomizeDaprCallerBase(IServiceProvider serviceProvider) : base(serviceProvider)
    {
        var hostEnvironment = serviceProvider.GetRequiredService<IWebHostEnvironment>();
        if (!hostEnvironment.IsDevelopment() || hostEnvironment.IsStaging())
            AppId = AppId + "-" + hostEnvironment.EnvironmentName;
    }
}