DurableFunctionsMonitor icon indicating copy to clipboard operation
DurableFunctionsMonitor copied to clipboard

DfMon Isolated: Support 'connectionName' in 'host.json'

Open dstenroejl opened this issue 10 months ago • 0 comments

Hi all,

For the durablefunctionsmonitor.dotnetisolated.core project.

Would it be possible to extend the code in ExtensionMethods.UseDurableFunctionsMonitor so it also allows use of the newer documented connection string configuration (connectionString supported from 2.7.0 or later)?

New code where I added connectionName:

            // 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 ??
                    hostJson?.extensions?.durableTask?.storageProvider?.connectionName;

                if (!string.IsNullOrEmpty(connStringNameFromHostJson))
                {
                    Globals.StorageConnStringEnvVarName = connStringNameFromHostJson;
                }
            }

I can prepare a PR if the change can be accepted. Just didn't want to do it if I'm missing something and the change could not be accepted. :)

dstenroejl avatar Mar 01 '25 14:03 dstenroejl