botframework-components
botframework-components copied to clipboard
Read app settings and override configuration to support encrypted values in app settings
Hi,
We started writing bot using composer and have the below requirement which am not sure how to achieve
- Have encrypted values app settings.json
- read app settings at runetime and decrypt all the encrypted values
- Bot uses configuration with decrypted values in step 2 I tried to see if we can override configuration but I see that
and I see that IConfiguration passed in to startup has Appsettings as part of collection and am not sure how can I achieve custom handling of configuration
one option is ,
I can have custom class for handling decryption of settings for the encrypted values in appsettings and register with DI like below in startup: ConfigureServices services.AddSingleton<ISettings, Settings>();
however am not sure how can I pass ISettings to custom actions (this is needed in custom actions)
Note: duplicate settings mentioned in above screenshot may need to be fixed
@praveenvavilla, thank you for opening this issue. For product behavior, how-to, or general understanding questions, please use Stackoverflow.
https://stackoverflow.com/search?q=bot+framework
Reopening issue for triaging tomorrow morning.
IConfiguration is just an uber object holding all kinds of config merged. You can always override IConfiguration after it's build\load, for example in Start.cs, what you can do is
Then, later, in any actions, you should be able to refer to your value via "settings" scope like, "settings.your.path.to.value".
Note the different seperator here, in the configuration override, you have to use ":" as seperator, because that's what asp.net's convention here. But in adaptive dialog, we did a reverse building, to make it "." when contructing the settings scope.
is there any other way on having custom settings class (read from cofiguration and decrypt them) passed to custom actions without writing back to IConfiguration object as you mentioned (we just want to avoid writing back to it)