Skip to content

Commit 512c9ea

Browse files
Merge release-1.13 back into master (#1285)
* Update protos and related use for Dapr 1.13. (#1236) * Update protos and related use. Signed-off-by: Phillip Hoff <[email protected]> * Update Dapr runtime version. Signed-off-by: Phillip Hoff <[email protected]> * Init properties. Signed-off-by: Phillip Hoff <[email protected]> --------- Signed-off-by: Phillip Hoff <[email protected]> * Update artifact action versions. (#1240) Signed-off-by: Phillip Hoff <[email protected]> * Make recursive true as default (#1243) Signed-off-by: Shivam Kumar <[email protected]> * Fix for secret key transformation in multi-value scenarios (#1274) * Add repro test. Signed-off-by: Phillip Hoff <[email protected]> * Fix for secret key transformation in multi-value scenarios. Signed-off-by: Phillip Hoff <[email protected]> --------- Signed-off-by: Phillip Hoff <[email protected]> * Update Dapr version numbers used during testing. Signed-off-by: Phillip Hoff <[email protected]> --------- Signed-off-by: Phillip Hoff <[email protected]> Signed-off-by: Shivam Kumar <[email protected]> Co-authored-by: Shivam Kumar <[email protected]>
1 parent 2e94bb1 commit 512c9ea

File tree

3 files changed

+40
-4
lines changed

3 files changed

+40
-4
lines changed

.github/workflows/itests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ jobs:
4343
GOARCH: amd64
4444
GOPROXY: https://proxy.golang.org
4545
DAPR_CLI_VER: 1.13.0
46-
DAPR_RUNTIME_VER: 1.13.0
47-
DAPR_INSTALL_URL: https://raw.githubusercontent.com/dapr/cli/release-1.13/install/install.sh
46+
DAPR_RUNTIME_VER: 1.13.2
47+
DAPR_INSTALL_URL: https://raw.githubusercontent.com/dapr/cli/release-1.12/install/install.sh
4848
DAPR_CLI_REF: ''
4949
steps:
5050
- name: Set up Dapr CLI

src/Dapr.Extensions.Configuration/DaprSecretStoreConfigurationProvider.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,15 @@ private async Task LoadAsync()
227227
$"A duplicate key '{key}' was found in the secret store '{store}'. Please remove any duplicates from your secret store.");
228228
}
229229

230-
data.Add(normalizeKey ? NormalizeKey(secretDescriptor.SecretName) : secretDescriptor.SecretName,
231-
result[key]);
230+
// The name of the key "as desired" by the user based on the descriptor.
231+
//
232+
// NOTE: This should vary only if a single secret of the same name is returned.
233+
string desiredKey = StringComparer.Ordinal.Equals(key, secretDescriptor.SecretKey) ? secretDescriptor.SecretName : key;
234+
235+
// The name of the key normalized based on the configured delimiters.
236+
string normalizedKey = normalizeKey ? NormalizeKey(desiredKey) : desiredKey;
237+
238+
data.Add(normalizedKey, result[key]);
232239
}
233240
}
234241

test/Dapr.Extensions.Configuration.Test/DaprSecretStoreConfigurationProviderTest.cs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,35 @@ public void LoadSecrets_FromSecretStoreThatCanReturnsMultipleValues()
198198
config[secondSecretKey].Should().Be(secondSecretValue);
199199
}
200200

201+
[Fact]
202+
public void LoadSecrets_FromSecretStoreThatCanReturnsMultivaluedValues()
203+
{
204+
var storeName = "store";
205+
var parentSecretKey = "connectionStrings";
206+
var firstSecretKey = "first_secret";
207+
var secondSecretKey = "second_secret";
208+
var firstSecretValue = "secret1";
209+
var secondSecretValue = "secret2";
210+
211+
var secretDescriptors = new[]
212+
{
213+
new DaprSecretDescriptor(parentSecretKey)
214+
};
215+
216+
var daprClient = new Mock<DaprClient>();
217+
218+
daprClient.Setup(c => c.GetSecretAsync(storeName, parentSecretKey,
219+
It.IsAny<Dictionary<string, string>>(), default))
220+
.ReturnsAsync(new Dictionary<string, string> { { firstSecretKey, firstSecretValue }, { secondSecretKey, secondSecretValue } });
221+
222+
var config = CreateBuilder()
223+
.AddDaprSecretStore(storeName, secretDescriptors, daprClient.Object)
224+
.Build();
225+
226+
config[firstSecretKey].Should().Be(firstSecretValue);
227+
config[secondSecretKey].Should().Be(secondSecretValue);
228+
}
229+
201230
[Fact]
202231
public void LoadSecrets_FromSecretStoreWithADifferentSecretKeyAndName()
203232
{

0 commit comments

Comments
 (0)