Skip to content

Commit cc06de2

Browse files
committed
fix(network): address code review feedback on IP resolver factory
1 parent 918101e commit cc06de2

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

src/Network/IpAddressResolverFactory.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ public static IIpAddressResolver CreateIpResolver(string[] args, (IpResolverType
2828
var (resolver, source) = DetermineBestFittingResolverWithSource(args, configuration);
2929
var allowRuntimeReconfiguration = source is not ResolverSource.StartParameter and not ResolverSource.EnvironmentVariable;
3030

31-
System.Console.WriteLine($"[IP RESOLVER DEBUG] args: {string.Join(" ", args)} | config: {configuration} | resolved: ({resolver.Type}, {resolver.Parameter}) | source: {source}");
31+
var logger = loggerFactory.CreateLogger(nameof(IpAddressResolverFactory));
32+
logger.LogDebug("args: {Args} | config: {Config} | resolved: ({ResolverType}, {ResolverParameter}) | source: {Source}", string.Join(" ", args), configuration, resolver.Type, resolver.Parameter, source);
3233
return new ConfigurableIpResolver(resolver.Type, resolver.Parameter, loggerFactory, allowRuntimeReconfiguration);
3334
}
3435

@@ -116,11 +117,7 @@ private static ((IpResolverType Type, string? Parameter) Resolver, ResolverSourc
116117

117118
if (configuration is { } byConfiguration)
118119
{
119-
if (byConfiguration.Type == IpResolverType.Custom && string.IsNullOrWhiteSpace(byConfiguration.Parameter))
120-
{
121-
// Invalid custom configuration, ignore it to fall back to environment default
122-
}
123-
else
120+
if (byConfiguration.Type != IpResolverType.Custom || !string.IsNullOrWhiteSpace(byConfiguration.Parameter))
124121
{
125122
return (byConfiguration, ResolverSource.Configuration);
126123
}

0 commit comments

Comments
 (0)