From eee46babd9e97a92354b642bac7251b7f377d719 Mon Sep 17 00:00:00 2001 From: Jon Gallant <2163001+jongio@users.noreply.github.com> Date: Thu, 16 Sep 2021 10:41:36 -0700 Subject: [PATCH] Add custom SignalR connection settings name (#75) --- iac/resources.bicep | 2 +- scripts/chown.sh | 16 +++++++++++++++- src/net/Services/Functions/NegotiateFunction.cs | 2 +- src/net/Services/Functions/ServiceBusFunction.cs | 2 +- src/net/Services/Functions/Startup.cs | 2 +- .../Services/Functions/StorageQueueFunction.cs | 2 +- 6 files changed, 20 insertions(+), 6 deletions(-) diff --git a/iac/resources.bicep b/iac/resources.bicep index f1a65fb..4c7b339 100644 --- a/iac/resources.bicep +++ b/iac/resources.bicep @@ -268,7 +268,7 @@ resource function 'Microsoft.Web/sites@2020-06-01' = { 'AzureWebJobsStorage__accountName': storage.name 'ServiceBusConnection__fullyQualifiedNamespace': '${service_bus.name}.servicebus.windows.net' 'StorageConnection__queueServiceUri': storage.properties.primaryEndpoints.queue - 'AzureSignalRConnectionString__serviceUri': 'https://${signalr.properties.hostName}' + 'SignalRConnection__serviceUri': 'https://${signalr.properties.hostName}' 'APPINSIGHTS_INSTRUMENTATIONKEY': logging.properties.InstrumentationKey 'FUNCTIONS_WORKER_RUNTIME': 'dotnet' 'FUNCTIONS_EXTENSION_VERSION': '~3' diff --git a/scripts/chown.sh b/scripts/chown.sh index 9a634cb..2f2c65a 100755 --- a/scripts/chown.sh +++ b/scripts/chown.sh @@ -1,5 +1,19 @@ #!/bin/bash set -euo pipefail +# Run this manually from the /scripts folder. + +export ROOT=..; + +echo "ADJUSTING FILE PERMISSIONS" + # You may need to run this in your devcontainer if you get build errors. -sudo chown -R codespace /home/codespace/workspace/src \ No newline at end of file + +# Use this if you don't have $ROOT and are running in codespace +# sudo chown -R codespace /home/codespace/workspace/src + +# Use the for all files +# sudo chown -v -R $USER $ROOT + +# Use this for only dll & CopyComplete files +find $ROOT -type f \( -name '*.dll' -o -name '*.CopyComplete' \) | xargs sudo chown -v -R $USER \ No newline at end of file diff --git a/src/net/Services/Functions/NegotiateFunction.cs b/src/net/Services/Functions/NegotiateFunction.cs index 8c3f2fb..76246c8 100644 --- a/src/net/Services/Functions/NegotiateFunction.cs +++ b/src/net/Services/Functions/NegotiateFunction.cs @@ -11,7 +11,7 @@ public static class NegotiateFunction [FunctionName(nameof(Negotiate))] public static SignalRConnectionInfo Negotiate( [HttpTrigger(AuthorizationLevel.Anonymous)] HttpRequest req, - [SignalRConnectionInfo(HubName = "%MessagingType%")] SignalRConnectionInfo connectionInfo, ILogger log) + [SignalRConnectionInfo(HubName = "%MessagingType%", ConnectionStringSetting = "SignalRConnection")] SignalRConnectionInfo connectionInfo, ILogger log) { log.LogInformation(connectionInfo.ToString()); return connectionInfo; diff --git a/src/net/Services/Functions/ServiceBusFunction.cs b/src/net/Services/Functions/ServiceBusFunction.cs index 6fa71df..88feb9b 100644 --- a/src/net/Services/Functions/ServiceBusFunction.cs +++ b/src/net/Services/Functions/ServiceBusFunction.cs @@ -10,7 +10,7 @@ public static class ServiceBusFunction [FunctionName(nameof(ServiceBusFunctionRun))] public static async Task ServiceBusFunctionRun( [ServiceBusTrigger("%ClientSyncQueueName%", Connection = "ServiceBusConnection")] string message, - [SignalR(HubName = "SERVICE_BUS_QUEUE")] IAsyncCollector messages, + [SignalR(HubName = "SERVICE_BUS_QUEUE", ConnectionStringSetting = "SignalRConnection")] IAsyncCollector messages, ILogger log) { log.LogInformation(message); diff --git a/src/net/Services/Functions/Startup.cs b/src/net/Services/Functions/Startup.cs index 484c4d5..df97798 100644 --- a/src/net/Services/Functions/Startup.cs +++ b/src/net/Services/Functions/Startup.cs @@ -51,7 +51,7 @@ public override void ConfigureAppConfiguration(IFunctionsConfigurationBuilder bu { using var listener = AzureEventSourceListener.CreateConsoleLogger(); - settings.Add("AzureSignalRConnectionString:serviceUri", Config.SignalREndpoint.ToString()); + settings.Add("SignalRConnection:serviceUri", Config.SignalREndpoint.ToString()); settings.Add("ServiceBusConnection:fullyQualifiedNamespace", Config.ServiceBusNamespace); if (Config.UseAzuriteQueue) diff --git a/src/net/Services/Functions/StorageQueueFunction.cs b/src/net/Services/Functions/StorageQueueFunction.cs index c6e9112..c5cd898 100644 --- a/src/net/Services/Functions/StorageQueueFunction.cs +++ b/src/net/Services/Functions/StorageQueueFunction.cs @@ -12,7 +12,7 @@ public static class StorageQueueFunction [FunctionName(nameof(StorageQueueFunctionRun))] public static async Task StorageQueueFunctionRun( [QueueTrigger("%ClientSyncQueueName%", Connection = "StorageConnection")] string message, - [SignalR(HubName = "STORAGE_QUEUE")] IAsyncCollector messages, + [SignalR(HubName = "STORAGE_QUEUE", ConnectionStringSetting = "SignalRConnection")] IAsyncCollector messages, ILogger log) { log.LogInformation(message);