-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AddStaticKeyPathAsync() method does not return data #121
Comments
Ahh you want to add a single key in that case? |
yes, if possible |
Okay that isn't how I have seen it used before but is a reasonable request I will look at the best way to support that later today. |
Thank you. And please 4.x package will be updated |
resolved by #123 also put into 4.1.14 and published for that. You can now do |
Thank you, but now all keys from consul start with |
I think the problem is in Maybe, simple fix will be something like this: private async Task<Dictionary<string, string>> BuildDictionaryAsync(string keyPath,
HttpResponseMessage response)
{
var content = await response.Content.ReadAsStringAsync();
var keys = JsonConvert.DeserializeObject<KeyValue[]>(content);
var parsedKeys = keys.SelectMany(k => _parser.Parse(k)).Distinct(new KeyValueComparer(keyPath, ConsulPath[0], CorePath));
var dictionary = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
foreach (var kv in parsedKeys)
{
- var key = kv.Key.Substring(keyPath.Length).Replace(ConsulPath[0], CorePath);
+ var key = kv.Key.Substring(keyPath.Length + Microsoft.Extensions.Configuration.ConfigurationPath.KeyDelimiter.Length).Replace(ConsulPath[0], CorePath);
var value = kv.IsDerivedKey ? kv.Value : kv.Value == null ? null : kv.ValueFromBase64();
dictionary[key] = value;
}
return dictionary;
} |
I can hopefully take a look at this tonight. |
I think, it happed because
AddStaticKeyPathAsync()
method usesConsulConfigSource.FormValidKey()
which adds/
character to the end.In consul documentation path looks like
/kv/:key
.https://demo.consul.io/v1/kv/hi - works
https://demo.consul.io/v1/kv/hi/ - not:(
The text was updated successfully, but these errors were encountered: