Skip to content

Commit

Permalink
Add custom SignalR connection settings name (#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
jongio authored Sep 16, 2021
1 parent b30ff39 commit eee46ba
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 6 deletions.
2 changes: 1 addition & 1 deletion iac/resources.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
16 changes: 15 additions & 1 deletion scripts/chown.sh
Original file line number Diff line number Diff line change
@@ -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

# 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
2 changes: 1 addition & 1 deletion src/net/Services/Functions/NegotiateFunction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/net/Services/Functions/ServiceBusFunction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<SignalRMessage> messages,
[SignalR(HubName = "SERVICE_BUS_QUEUE", ConnectionStringSetting = "SignalRConnection")] IAsyncCollector<SignalRMessage> messages,
ILogger log)
{
log.LogInformation(message);
Expand Down
2 changes: 1 addition & 1 deletion src/net/Services/Functions/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/net/Services/Functions/StorageQueueFunction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<SignalRMessage> messages,
[SignalR(HubName = "STORAGE_QUEUE", ConnectionStringSetting = "SignalRConnection")] IAsyncCollector<SignalRMessage> messages,
ILogger log)
{
log.LogInformation(message);
Expand Down

0 comments on commit eee46ba

Please sign in to comment.