* #217, implementation for inproc * #217, implementation for isolated * #217, implementation for vscode ext
This commit is contained in:
Родитель
9a99d06c21
Коммит
88455a5921
|
@ -115,7 +115,7 @@ export class MonitorViewList {
|
|||
return this._monitorViews[keys[0]];
|
||||
}
|
||||
|
||||
// Parses local project files and tries to infer connction settings from them
|
||||
// Parses local project files and tries to infer connection settings from them
|
||||
getStorageConnectionSettingsFromCurrentProject(defaultTaskHubName?: string, projectPath?: string): StorageConnectionSettings | null {
|
||||
|
||||
const hostJson = this.readHostJson(projectPath);
|
||||
|
@ -158,7 +158,7 @@ export class MonitorViewList {
|
|||
return new StorageConnectionSettings(ConnStringUtils.ExpandEmulatorShortcutIfNeeded(storageConnString), hubName, hubsConnString);
|
||||
}
|
||||
|
||||
const storageConnString = this.getValueFromLocalSettings('AzureWebJobsStorage', projectPath);
|
||||
const storageConnString = this.getValueFromLocalSettings(hostJson.connectionStringName || 'AzureWebJobsStorage', projectPath);
|
||||
if (!storageConnString) {
|
||||
return null;
|
||||
}
|
||||
|
@ -512,6 +512,8 @@ export class MonitorViewList {
|
|||
result.connectionStringName = durableTask.storageProvider.StorageConnectionName || 'AzureWebJobsStorage';
|
||||
result.otherConnectionStringName = durableTask.storageProvider.EventHubsConnectionName || 'EventHubsConnection';
|
||||
break;
|
||||
default:
|
||||
result.connectionStringName = durableTask.storageProvider.connectionStringName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -204,7 +204,7 @@ namespace DurableFunctionsMonitor.DotNetBackend
|
|||
try
|
||||
{
|
||||
var hubNames = new HashSet<string>(
|
||||
await DfmEndpoint.ExtensionPoints.GetTaskHubNamesRoutine(EnvVariableNames.AzureWebJobsStorage),
|
||||
await DfmEndpoint.ExtensionPoints.GetTaskHubNamesRoutine(DfmEndpoint.StorageConnStringEnvVarName),
|
||||
StringComparer.InvariantCultureIgnoreCase
|
||||
);
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ namespace DurableFunctionsMonitor.DotNetBackend
|
|||
{
|
||||
if (IsDefaultConnectionStringName(connName))
|
||||
{
|
||||
return EnvVariableNames.AzureWebJobsStorage;
|
||||
return DfmEndpoint.StorageConnStringEnvVarName;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -8,6 +8,7 @@ using System.Linq;
|
|||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Azure.WebJobs.Extensions.DurableTask;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace DurableFunctionsMonitor.DotNetBackend
|
||||
{
|
||||
|
@ -185,6 +186,22 @@ namespace DurableFunctionsMonitor.DotNetBackend
|
|||
{
|
||||
_customUserAgent = $"DurableFunctionsMonitor-Injected/{GetVersion()}";
|
||||
}
|
||||
|
||||
// Checking host.json for a custom dedicated Storage account
|
||||
string hostJsonFileName = Globals.GetHostJsonPath();
|
||||
if (File.Exists(hostJsonFileName))
|
||||
{
|
||||
dynamic hostJson = JObject.Parse(File.ReadAllText(hostJsonFileName));
|
||||
|
||||
string connStringNameFromHostJson =
|
||||
hostJson?.extensions?.durableTask?.storageProvider?.azureStorageConnectionStringName ??
|
||||
hostJson?.extensions?.durableTask?.storageProvider?.connectionStringName;
|
||||
|
||||
if (!string.IsNullOrEmpty(connStringNameFromHostJson))
|
||||
{
|
||||
_storageConnStringEnvVarName = connStringNameFromHostJson;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal static DfmSettings Settings
|
||||
|
@ -220,9 +237,18 @@ namespace DurableFunctionsMonitor.DotNetBackend
|
|||
get { return _customUserAgent; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Provides support for dedicated Storage accounts (different from AzureWebJobsStorage)
|
||||
/// </summary>
|
||||
internal static string StorageConnStringEnvVarName
|
||||
{
|
||||
get { return _storageConnStringEnvVarName; }
|
||||
}
|
||||
|
||||
private static DfmSettings _settings = null;
|
||||
private static DfmExtensionPoints _extensionPoints = new DfmExtensionPoints();
|
||||
private static string _customUserAgent;
|
||||
private static string _storageConnStringEnvVarName = EnvVariableNames.AzureWebJobsStorage;
|
||||
|
||||
/// <summary>
|
||||
/// Checks whether we should do our internal initialization (Standalone mode)
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace DurableFunctionsMonitor.DotNetBackend
|
|||
if (!string.IsNullOrEmpty(dfmNonce))
|
||||
{
|
||||
// For VsCode loading Task Hubs directly and without validation
|
||||
hubNames = await DfmEndpoint.ExtensionPoints.GetTaskHubNamesRoutine(EnvVariableNames.AzureWebJobsStorage);
|
||||
hubNames = await DfmEndpoint.ExtensionPoints.GetTaskHubNamesRoutine(DfmEndpoint.StorageConnStringEnvVarName);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -200,7 +200,7 @@ namespace DurableFunctionsMonitor.DotNetIsolated
|
|||
try
|
||||
{
|
||||
var hubNames = new HashSet<string>(
|
||||
await extensionPoints.GetTaskHubNamesRoutine(EnvVariableNames.AzureWebJobsStorage),
|
||||
await extensionPoints.GetTaskHubNamesRoutine(Globals.StorageConnStringEnvVarName),
|
||||
StringComparer.InvariantCultureIgnoreCase
|
||||
);
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ using Microsoft.Azure.Functions.Worker;
|
|||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace DurableFunctionsMonitor.DotNetIsolated
|
||||
{
|
||||
|
@ -52,6 +53,22 @@ namespace DurableFunctionsMonitor.DotNetIsolated
|
|||
builder.Services.AddSingleton(settings);
|
||||
builder.Services.AddSingleton(extensionPoints);
|
||||
|
||||
// Checking host.json for a custom dedicated Storage account
|
||||
string hostJsonFileName = Globals.GetHostJsonPath();
|
||||
if (File.Exists(hostJsonFileName))
|
||||
{
|
||||
dynamic hostJson = JObject.Parse(File.ReadAllText(hostJsonFileName));
|
||||
|
||||
string connStringNameFromHostJson =
|
||||
hostJson?.extensions?.durableTask?.storageProvider?.azureStorageConnectionStringName ??
|
||||
hostJson?.extensions?.durableTask?.storageProvider?.connectionStringName;
|
||||
|
||||
if (!string.IsNullOrEmpty(connStringNameFromHostJson))
|
||||
{
|
||||
Globals.StorageConnStringEnvVarName = connStringNameFromHostJson;
|
||||
}
|
||||
}
|
||||
|
||||
// Adding middleware
|
||||
builder.UseWhen
|
||||
(
|
||||
|
|
|
@ -65,6 +65,11 @@ namespace DurableFunctionsMonitor.DotNetIsolated
|
|||
|
||||
public const string DfmModeContextValue = "DfmModeContextValue";
|
||||
|
||||
/// <summary>
|
||||
/// Provides support for dedicated Storage accounts (different from AzureWebJobsStorage)
|
||||
/// </summary>
|
||||
internal static string StorageConnStringEnvVarName = EnvVariableNames.AzureWebJobsStorage;
|
||||
|
||||
public static void SplitConnNameAndHubName(string connAndHubName, out string connName, out string hubName)
|
||||
{
|
||||
int pos = connAndHubName.LastIndexOf("-");
|
||||
|
@ -99,7 +104,7 @@ namespace DurableFunctionsMonitor.DotNetIsolated
|
|||
{
|
||||
if (IsDefaultConnectionStringName(connName))
|
||||
{
|
||||
return EnvVariableNames.AzureWebJobsStorage;
|
||||
return StorageConnStringEnvVarName;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -25,7 +25,7 @@ namespace DurableFunctionsMonitor.DotNetIsolated
|
|||
if (!string.IsNullOrEmpty(dfmNonce))
|
||||
{
|
||||
// For VsCode loading Task Hubs directly and without validation
|
||||
hubNames = await this.ExtensionPoints.GetTaskHubNamesRoutine(EnvVariableNames.AzureWebJobsStorage);
|
||||
hubNames = await this.ExtensionPoints.GetTaskHubNamesRoutine(Globals.StorageConnStringEnvVarName);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче