diff --git a/EnotaryoPH/EnotaryoPH.Web/Program.cs b/EnotaryoPH/EnotaryoPH.Web/Program.cs index 725f335..aa0bcda 100644 --- a/EnotaryoPH/EnotaryoPH.Web/Program.cs +++ b/EnotaryoPH/EnotaryoPH.Web/Program.cs @@ -1,4 +1,7 @@ using System.Security.Principal; +using Azure.Communication.CallAutomation; +using Azure.Communication.Identity; +using Azure.Communication.Rooms; using Coravel; using EnotaryoPH.Data; using EnotaryoPH.Web.Common.Hubs; @@ -55,6 +58,28 @@ namespace EnotaryoPH.Web builder.Services.AddQueue(); builder.Services.AddMailer(config); builder.Services.AddTransient(); + builder.Services.AddTransient(); + builder.Services.AddScoped(provider => + { + var connectionString = config.GetConnectionString("AzureCommunication"); + return string.IsNullOrEmpty(connectionString) + ? throw new InvalidConfigurationException("AzureCommunication", string.Empty) + : new RoomsClient(connectionString); + }); + builder.Services.AddScoped(provider => + { + var connectionString = config.GetConnectionString("AzureCommunication"); + return string.IsNullOrEmpty(connectionString) + ? throw new InvalidConfigurationException("AzureCommunication", string.Empty) + : new CommunicationIdentityClient(connectionString); + }); + builder.Services.AddScoped(provider => + { + var connectionString = config.GetConnectionString("AzureCommunication"); + return string.IsNullOrEmpty(connectionString) + ? throw new InvalidConfigurationException("AzureCommunication", string.Empty) + : new CallAutomationClient(connectionString); + }); var app = builder.Build(); diff --git a/EnotaryoPH/EnotaryoPH.Web/appsettings.json b/EnotaryoPH/EnotaryoPH.Web/appsettings.json index 42f980d..434ba75 100644 --- a/EnotaryoPH/EnotaryoPH.Web/appsettings.json +++ b/EnotaryoPH/EnotaryoPH.Web/appsettings.json @@ -7,7 +7,8 @@ }, "AllowedHosts": "*", "ConnectionStrings": { - "NotaryoDatabase": "Host=localhost; Database=enotaryodb; Username=enotaryodbuser; Password=secret" + "NotaryoDatabase": "Host=localhost; Database=enotaryodb; Username=enotaryodbuser; Password=secret", + "AzureCommunication": "secret" }, "CompreFaceConfig": { "APIKey": "secret",