-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Conversation
/// Get user defaults path | ||
pub fn user_defaults_path(&self) -> PathBuf { | ||
let mut dir = Path::new(&self.db).to_path_buf(); | ||
dir.push("user_defaults"); |
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.
I think the path should be network-dependent.
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.
agree
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.
updated
} | ||
} | ||
|
||
pub fn tracing_switch_to_bool(switch: Switch, user_defaults: &UserDefaults) -> Result<bool, String> { |
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.
It could be UserDefaults
method?
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.
Test would be good too - logic here seems to be pretty fragile.
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.
I don't think this method fits UserDefaults
well. Tests added in latest commit
Why do we need such a file if there's a way to get all the information from the database? |
Currently different modules are responsible for reading / writing user settings to db. I wanted to gather all of them in one place. I used a file, mostly because it's easier to debug user settings there. |
Should store dapps hosts, rpc modules, etc. as well (probably future work) |
IMHO options you listed should be stored in config files: #880 - they don't force you to re-sync and are not part of "state" of the app. |
Yeah, those are probably a better place. Although it might start to get confusing with multiple configuration files for different purposes, particularly once we start to add presets into the mix (including user-made presets) |
Changes Unknown when pulling 0e788d6 on user_default into * on master*. |
I don't like the idea of having an additional config file for defaults. Looks like an unnecessary complication to me. Just another maintenance burden with no real benefits. It would be sufficient to just add a message on startup if |
I would not call it a |
* 'master' of https://github.com/ethcore/parity: user defaults (#2014) Fixing jit feature compilation (#2310) Lenient bytes deserialization (#2036) Fixing tests saturating add Remove crufty code saturating not overflowing Peek transaction queue via RPC (#2270) Avoid penalizing legit transactions Penalize transactions with gas above gas limit Improving txqueue logs
* js: user defaults (#2014) Fixing jit feature compilation (#2310) Lenient bytes deserialization (#2036) Fixing tests saturating add Remove crufty code saturating not overflowing Peek transaction queue via RPC (#2270) Avoid penalizing legit transactions Penalize transactions with gas above gas limit Improving txqueue logs
The goal of this pr is to have one place (file) in which we store user options from previous launches.
Right now there are two options stored in
UserDefaults
:UserDefaults could be also used for other options, eg. fatdb in #1974