Skip to content

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

Open
@dstenroejl

Description

@dstenroejl

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. :)

Metadata

Metadata

Assignees

Labels

P2Priority 2

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions