fix: Propagate base_url and api_key when processing includes

json-serializing-nullable-fields-issue
Robert Dailey 8 months ago
parent 537defbfe3
commit 9995572314

@ -25,18 +25,7 @@ public class ImplicitUrlAndKeyPostProcessor : IConfigPostProcessor
private IReadOnlyDictionary<string, T>? ProcessService<T>(IReadOnlyDictionary<string, T>? services)
where T : ServiceConfigYaml
{
if (services is null)
{
return null;
}
var updatedServices = new Dictionary<string, T>();
foreach (var (name, service) in services)
{
updatedServices.Add(name, FillUrlAndKey(name, service));
}
return updatedServices;
return services?.ToDictionary(x => x.Key, x => FillUrlAndKey(x.Key, x.Value));
}
private T FillUrlAndKey<T>(string instanceName, T config)

@ -60,6 +60,9 @@ public class IncludePostProcessor : IConfigPostProcessor
// Merge the config into the aggregated includes so that root config values overwrite included values.
mergedConfigs.Add(key, merger.Merge(aggregateInclude, config) with
{
BaseUrl = config.BaseUrl,
ApiKey = config.ApiKey,
// No reason to keep these around anymore now that they have been merged
Include = null
});

@ -129,6 +129,8 @@ public class IncludePostProcessorIntegrationTest : ConfigIntegrationFixture
{
["service1"] = new()
{
BaseUrl = "the_base_url",
ApiKey = "the_api_key",
CustomFormats = new[]
{
new CustomFormatConfigYaml
@ -157,6 +159,9 @@ public class IncludePostProcessorIntegrationTest : ConfigIntegrationFixture
{
["service1"] = new()
{
BaseUrl = "the_base_url",
ApiKey = "the_api_key",
Include = null,
CustomFormats = new[]
{
new CustomFormatConfigYaml {TrashIds = new[] {"496f355514737f7d83bf7aa4d24f8169"}},

Loading…
Cancel
Save