Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
src/components/config_editor.rs
Outdated
There was a problem hiding this comment.
Add comments to all functions.
src/components/p2pool_parser.rs
Outdated
There was a problem hiding this comment.
Rename to p2poolv2_config_parser.rs
There was a problem hiding this comment.
Use config.rs crate and we won't have to do string split on = to get key/value pairs. We will also get the sections.
See how we do it here: https://github.com/p2poolv2/p2poolv2/blob/main/p2poolv2_lib/src/config.rs
src/main.rs
Outdated
| // File Selected! | ||
| app.bitcoin_conf_path = Some(path); | ||
| app.toggle_menu(); // Go back to main screen | ||
| if let Some(path) = app.explorer.select().filter(|p| p.is_file()) { |
There was a problem hiding this comment.
I have a fear this navigation is going to become a HUGE case statement. Can we compose this from smaller case statements per section? See if ratatui provides support for this.
pool2win
left a comment
There was a problem hiding this comment.
It is a large PR. It'll be really nice to split it into two. UI changes with the refactors you mentioned and one for reading/updating/writing config file.
We also need to clean up the legacy config format. We never used it in p2pool. IDK why you have that here TBH.
| use super::p2poolv2_config_parser::{ConfigField, ConfigSection}; | ||
|
|
||
| /// Parses legacy p2pool.conf (key=value) format into UI sections | ||
| pub fn parse_legacy_p2pool_conf<P: AsRef<Path>>(path: P) -> io::Result<Vec<ConfigSection>> { |
There was a problem hiding this comment.
i added this because one test was failing maybe when a non-toml file was selected, so i intriduced key=value parser to make the test pass.
and yeah the fallback dosent correspond to the real config format, i just introduced to make the test pass
ill make it strictly TOML/schema-driven
There was a problem hiding this comment.
the test case is wrong , and because of it i had to add it just to make it pass . ill remove it .
thanks
| pub fn parse_p2poolv2_config<P: AsRef<Path>>(path: P) -> io::Result<Vec<ConfigSection>> { | ||
| let path = path.as_ref(); | ||
|
|
||
| // Try TOML first |
There was a problem hiding this comment.
We only have toml config files, so no need to fall back to legacy. Lets clean that up.
| use crate::components::p2poolv2_config_schema::Config; | ||
|
|
||
| #[derive(Clone, Debug, PartialEq)] | ||
| pub struct ConfigField { |
There was a problem hiding this comment.
Since we only have toml config file, I think we might also not need this struct.
|
Interesting. If someone selects a non-toml file, the config.rs parser will
raise an error. We should depend on the error and show a meaningful error
to the user.
…On Wed, 14 Jan 2026 at 15:57, R27 ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In src/components/legacy_p2pool_parser.rs
<#9 (comment)>:
> @@ -0,0 +1,56 @@
+// SPDX-FileCopyrightText: 2024 PDM Authors
+// SPDX-License-Identifier: AGPL-3.0-or-later
+
+use std::fs::File;
+use std::io::{self, BufRead};
+use std::path::Path;
+
+use super::p2poolv2_config_parser::{ConfigField, ConfigSection};
+
+/// Parses legacy p2pool.conf (key=value) format into UI sections
+pub fn parse_legacy_p2pool_conf<P: AsRef<Path>>(path: P) -> io::Result<Vec<ConfigSection>> {
i added this because one test was failing maybe when a non-toml file was
selected, so i intriduced key=value parser to make the test pass.
and yeah the fallback dosent correspond to the real config format, i just
introduced to make the test pass
ill make it strictly TOML/schema-driven
—
Reply to this email directly, view it on GitHub
<#9 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ASU3SYKKSPFC2XRSG7QELA34GZKNNAVCNFSM6AAAAACQU6VLHCVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZTMNRRGE3TINJXG4>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Got it |
e5ca31d to
dafc799
Compare
P2Pool Config Integration and config tests