Skip to content

Commit

Permalink
Rename extension methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Metal-Mighty committed May 30, 2024
1 parent 7f2d0f9 commit e4db540
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ namespace LoRaWan.NetworkServer.Extensions;

public static class UpstreamProtocolExtensions
{
public static UpstreamProtocol StringToUpstreamProtocol(this string value)
public static UpstreamProtocol ToUpstreamProtocol(this string value)
{
return Enum.TryParse(value, true, out UpstreamProtocol upstreamProtocol)
? throw new ArgumentOutOfRangeException(nameof(value), value,
$"Invalid value '{value}' for UpstreamProtocol")
: upstreamProtocol;
}

public static TransportType UpstreamProtocolToTransportType(this UpstreamProtocol value)
public static TransportType ToTransportType(this UpstreamProtocol value)
{
return value switch
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,8 @@ public static NetworkServerConfiguration CreateFromEnvironmentVariables()
: throw new NotSupportedException($"'IOTHUB_CONNECTION_POOL_SIZE' needs to be between 1 and {AmqpConnectionPoolSettings.AbsoluteMaxPoolSize}.");

config.UpstreamProtocol = envVars.GetEnvVar("UPSTREAM_PROTOCOL", "Amqp")
.StringToUpstreamProtocol()
.UpstreamProtocolToTransportType();
.ToUpstreamProtocol()
.ToTransportType();

config.RedisConnectionString = envVars.GetEnvVar("REDIS_CONNECTION_STRING", string.Empty);
if (!config.RunningAsIoTEdgeModule && !config.IsLocalDevelopment && string.IsNullOrEmpty(config.RedisConnectionString))
Expand Down

0 comments on commit e4db540

Please sign in to comment.