-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Load bot credentials from an .env file (#138)
* Added an Extensions module for the chatbot
- Loading branch information
1 parent
5111cd8
commit f8604f2
Showing
7 changed files
with
36 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace DentallApp.Configuration; | ||
|
||
public class BotSettings | ||
{ | ||
public string MicrosoftAppType { get; set; } | ||
public string MicrosoftAppId { get; set; } | ||
public string MicrosoftAppPassword { get; set; } | ||
public string MicrosoftAppTenantId { get; set; } | ||
} |
14 changes: 14 additions & 0 deletions
14
src/Features/Chatbot/Extensions/ConfigurationExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
namespace DentallApp.Features.Chatbot.Extensions; | ||
|
||
public static class ConfigurationExtensions | ||
{ | ||
public static IConfiguration SetBotCredentials(this IConfiguration configuration) | ||
{ | ||
var botSettings = new EnvBinder().Bind<BotSettings>(); | ||
configuration[MicrosoftAppCredentials.MicrosoftAppTypeKey] = botSettings.MicrosoftAppType .Trim(); | ||
configuration[MicrosoftAppCredentials.MicrosoftAppIdKey] = botSettings.MicrosoftAppId .Trim(); | ||
configuration[MicrosoftAppCredentials.MicrosoftAppPasswordKey] = botSettings.MicrosoftAppPassword.Trim(); | ||
configuration[MicrosoftAppCredentials.MicrosoftAppTenantIdKey] = botSettings.MicrosoftAppTenantId.Trim(); | ||
return configuration; | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...es/Chatbot/ServiceCollectionExtensions.cs → ...Extensions/ServiceCollectionExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...Chatbot/WaterfallStepContextExtensions.cs → ...ensions/WaterfallStepContextExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters