-
Notifications
You must be signed in to change notification settings - Fork 492
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[refactor] Client Config
: Pass path around to prepare for extraction from Config
#11860
[refactor] Client Config
: Pass path around to prepare for extraction from Config
#11860
Conversation
@@ -149,7 +151,7 @@ public ApplicationSettings(PersistentConfig persistentConfig, Config config, UiC | |||
.Where(value => value && string.IsNullOrEmpty(LocalBitcoinCoreDataDir)) | |||
.Subscribe(_ => LocalBitcoinCoreDataDir = EnvironmentHelpers.GetDefaultBitcoinCoreDataDirOrEmptyString()); | |||
|
|||
// Apply RunOnSystenStartup | |||
// Apply RunOnSystemStartup |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo
else | ||
{ | ||
return Money.Parse(stringValue); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unrelated. Yet simpler.
ConfigFilePath = Path.Combine(Config.DataDir, "Config.json"); | ||
Directory.CreateDirectory(Config.DataDir); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved here from the LoadOrCreateConfigs
method.
Config
: Pass path around to prepare for extraction from Config
.Config
: Pass path around to prepare for extraction from Config
@@ -122,7 +122,7 @@ private static IClientConfig CreateConfig() | |||
|
|||
private static IApplicationSettings CreateApplicationSettings() | |||
{ | |||
return new ApplicationSettings(Services.PersistentConfig, Services.Config, Services.UiConfig); | |||
return new ApplicationSettings(Services.PersistentConfigFilePath, Services.PersistentConfig, Services.Config, Services.UiConfig); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just pass the config file path on.
{ | ||
_startupConfig = new PersistentConfig(persistentConfig.FilePath); | ||
_persistentConfigFilePath = persistentConfigFilePath; | ||
_startupConfig = new PersistentConfig(persistentConfigFilePath); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The important thing here is that we do not access the config path using persistentConfig.FilePath
but rather persistentConfigFilePath
. That's what we want.
Config = Guard.NotNull(nameof(config), config); | ||
ExecuteWhenChanged = Guard.NotNull(nameof(executeWhenChanged), executeWhenChanged); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unrelated but a trivial change to remove unneeded code (plus if one wants it makes it easier to unit test this class actually).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tACK
Thanks for your comments, it made the review much easier.
What about UiConfig
and Logs
, and mostly all other cases where we need Path.Combine(DataDir, ...)
?
👍
I don't think we need to get rid of all Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Currently
Config
class hasFilePath
property but it has downsides:This PR passes the path for persistent config separately and avoids all these issues. The PR is meant to be a precursor for #11764 and to slowly move towards a better design.
No change in behavior is intended.