Skip to content

Commit

Permalink
[config] It should be possible to modify settings in UI when `--LogLe…
Browse files Browse the repository at this point in the history
…vel` is set (WalletWasabi#13002)

* Add an exception for `LogLevel`
* Update WalletWasabi.Daemon/Config.cs
  • Loading branch information
kiminuo authored May 9, 2024
1 parent adc20b9 commit a678b77
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions WalletWasabi.Daemon/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,18 @@ [ nameof(CoordinatorIdentifier)] = (
};

// Check if any config value is overridden (either by an environment value, or by a CLI argument).
foreach ((_, IValue optionValue) in Data.Values)
foreach (string optionName in Data.Keys)
{
if (optionValue.Overridden)
// It is allowed to override the log level.
if (!string.Equals(optionName, nameof(LogLevel)))
{
IsOverridden = true;
break;
(_, IValue optionValue) = Data[optionName];

if (optionValue.Overridden)
{
IsOverridden = true;
break;
}
}
}

Expand Down Expand Up @@ -185,6 +191,12 @@ [ nameof(CoordinatorIdentifier)] = (
EnvironmentHelpers.GetDataDir(Path.Combine("WalletWasabi", "Client")),
Environment.GetCommandLineArgs()).EffectiveValue;

/// <summary>Whether a config option was overridden by a command line argument or an environment variable.</summary>
/// <remarks>
/// Changing config options in the UI while a config option is overridden would bring uncertainty if user understands consequences or not,
/// thus it is normally not allowed. However, there are exceptions as what options are taken into account, there is currently
/// one exception: <see cref="LogLevel"/>.
/// </remarks>
public bool IsOverridden { get; }

public EndPoint GetBitcoinP2pEndPoint()
Expand Down

0 comments on commit a678b77

Please sign in to comment.