Skip to content

Commit 76b9791

Browse files
committed
Using alternate setting for blob key storage location
1 parent d965b75 commit 76b9791

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/WebJobs.Script.WebHost/Security/BlobStorageSecretsRepository.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public sealed class BlobStorageSecretsRepository : ISecretsRepository, IDisposab
2929
private readonly string _accountConnectionString;
3030
private bool _disposed = false;
3131

32-
public BlobStorageSecretsRepository(string secretSentinelDirectoryPath, string accountConnectionString, string siteHostName)
32+
public BlobStorageSecretsRepository(string secretSentinelDirectoryPath, string accountConnectionString, string siteSlotName)
3333
{
3434
if (secretSentinelDirectoryPath == null)
3535
{
@@ -39,6 +39,10 @@ public BlobStorageSecretsRepository(string secretSentinelDirectoryPath, string a
3939
{
4040
throw new ArgumentNullException(nameof(accountConnectionString));
4141
}
42+
if (siteSlotName == null)
43+
{
44+
throw new ArgumentNullException(nameof(siteSlotName));
45+
}
4246

4347
_secretsSentinelFilePath = secretSentinelDirectoryPath;
4448
_hostSecretsSentinelFilePath = Path.Combine(_secretsSentinelFilePath, ScriptConstants.HostMetadataFileName);
@@ -48,7 +52,7 @@ public BlobStorageSecretsRepository(string secretSentinelDirectoryPath, string a
4852
_sentinelFileWatcher = new AutoRecoveringFileSystemWatcher(_secretsSentinelFilePath, "*.json");
4953
_sentinelFileWatcher.Changed += OnChanged;
5054

51-
_secretsBlobPath = siteHostName.ToLowerInvariant();
55+
_secretsBlobPath = siteSlotName.ToLowerInvariant();
5256
_hostSecretsBlobPath = string.Format("{0}/{1}", _secretsBlobPath, ScriptConstants.HostMetadataFileName);
5357

5458
_accountConnectionString = accountConnectionString;

src/WebJobs.Script.WebHost/Security/DefaultSecretsRepositoryFactory.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ public ISecretsRepository Create(ScriptSettingsManager settingsManager, WebHostS
1919
string storageString = AmbientConnectionStringProvider.Instance.GetConnectionString(ConnectionStringNames.Storage);
2020
if (secretStorageType != null && secretStorageType.Equals("Blob", StringComparison.OrdinalIgnoreCase) && storageString != null)
2121
{
22-
string siteHostId = settingsManager.AzureWebsiteDefaultSubdomain ?? config.HostConfig.HostId;
23-
return new BlobStorageSecretsRepository(Path.Combine(webHostSettings.SecretsPath, "Sentinels"), storageString, siteHostId);
22+
string siteSlotName = settingsManager.AzureWebsiteUniqueSlotName ?? config.HostConfig.HostId;
23+
return new BlobStorageSecretsRepository(Path.Combine(webHostSettings.SecretsPath, "Sentinels"), storageString, siteSlotName);
2424
}
2525
else
2626
{

0 commit comments

Comments
 (0)