Skip to content

Commit

Permalink
move warening to Extension
Browse files Browse the repository at this point in the history
  • Loading branch information
forsthug committed Jan 25, 2024
1 parent ee5719b commit c0cc9c6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/fiskaltrust.Launcher/Commands/Common.cs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ public static async Task<int> HandleAsync<O, S>(
// will exit with non-zero exit code later.
Log.Fatal(e, "Could not read Cashbox configuration file.");
}

launcherConfiguration.LogConfigurationWarnings(Log.Logger);
var cashboxConfiguration = new ftCashBoxConfiguration();
try
{
Expand Down
9 changes: 0 additions & 9 deletions src/fiskaltrust.Launcher/Commands/ConfigCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ public static async Task<int> HandleAsync(ConfigSetOptions configSetOptions)
}

launcherConfiguration.OverwriteWith(configSetOptions.ArgsLauncherConfiguration);
LogConfigurationWarnings(launcherConfiguration);

string rawLauncherConfigurationNew;
rawLauncherConfigurationNew = launcherConfiguration.Serialize(true, true);
Expand Down Expand Up @@ -175,14 +174,6 @@ public static async Task<int> HandleAsync(ConfigSetOptions configSetOptions)

return 0;
}

private static void LogConfigurationWarnings(LauncherConfiguration launcherConfiguration)
{
if (launcherConfiguration.UseLegacyDataProtection.HasValue)
{
Log.Warning("Configuration 'UseLegacyDataProtection' is depreciated and will be removed in future.");
}
}
}

public class ConfigGetCommand : Command
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using fiskaltrust.Launcher.Common.Configuration;

namespace fiskaltrust.Launcher.Extensions
{
static class LauncherConfigurationExtension
{
public static void LogConfigurationWarnings(this LauncherConfiguration launcherConfiguration, Serilog.ILogger logger)
{
if (launcherConfiguration.UseLegacyDataProtection.HasValue)
{
logger.Warning("Configuration 'UseLegacyDataProtection' is depreciated and will be removed in future.");
}
}
}
}

0 comments on commit c0cc9c6

Please sign in to comment.