Fix cleaning up storage account of LCS-hosted environment, by loading storage string from web.config#98
Conversation
…nfig On LCS-hosted environments the Azure storage connection string is not required in the userConfig. In this case, the connection string is loaded from the web.config file. The file is decrypted first. I do not have access to an LCS-hosted environment, but on my SingleOneBox environment the correct string can be loaded from webconfig, tables are cleared, and the web.config is encrypted afterwards. #patch resolves microsoft#97
|
@AndreasHassing / @Omaaarz you clarify for me: |
To help ensure that issues won't occur, we need a sequence like:
|
|
Where should this temporary directory be located? Would it be fine to create a temporary folder in the folder with the executables for the program? |
Whenever the AzureStorage field of Web.config is accessed the file is copied, decrypted, read and deleted again. The copy is stored in "tmp" in the folder with the executable. Tested manually by running the cleaning and ensuring the file was decrypted and deleted afterwards
.NET has an API to get a temporary file path: |
Get the path of a temporary file in the user's temporary directory and write to this file instead of creating a temporary folder in the current directory.
AndreasHassing
left a comment
There was a problem hiding this comment.
Approving with nit comments 👍.
Omaaarz
left a comment
There was a problem hiding this comment.
Looks good to me. I have 1 suggestion.
Make GetKey case insensitive and enable file paths with spaces. Tested on custom file paths.
Add flag to constructer, deciding if the webconfig should be decrypted before reading it. This way the file is only decrypted once.
On LCS-hosted environments the Azure storage connection string is not required in the userConfig. In this case, the connection string is loaded from the web.config file. The file is decrypted first.
I do not have access to an LCS-hosted environment, but on my SingleOneBox environment the correct string can be loaded from webconfig, tables are cleared, and the web.config is encrypted afterwards.
#patch
resolves #97