-
Notifications
You must be signed in to change notification settings - Fork 10
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
feat: automated node config path args #85
Conversation
The user previously had to specify the location of our generated config file. This change removes this requirement -- since we generate it, we should also pass on the information to the node.
src/setup/node.rs
Outdated
}) | ||
}; | ||
|
||
// insert the config file cmd args |
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'm not too happy with the location of this code -- but my brain is too fried to think of a better place.
Happy to get suggestions.
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'd probably make the change in NodeMetaData::new
since that's where it's constructed from the args.
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.
We need access to Node::config_filepath()
for the actual location of the generated file. We could move that down a layer as well?
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.
Works for me 👍
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.
This is a great idea—left a few suggestions.
src/setup/node.rs
Outdated
}) | ||
}; | ||
|
||
// insert the config file cmd args |
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'd probably make the change in NodeMetaData::new
since that's where it's constructed from the args.
src/setup/node.rs
Outdated
let start_arg = node | ||
.meta | ||
.start_args | ||
.pop() |
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.
You could probably make an insert
at i = len - 2
instead?
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 was worried that having it twice in a row might be confusing (since its two separate args). But I think yours is still better.
src/setup/node.rs
Outdated
node.meta.start_args.push("--config".into()); | ||
node.meta | ||
.start_args | ||
.push(node.config_filepath().into_os_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.
These two previous steps could probably be condensed (perhaps with format!
and OsString::from
)?
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.
For some reason combining the two into one, results in extra quotes around just that pair of args which breaks the command.
So instead of
`arg1 arg2 arg3 arg4 start`
we get
`arg1 arg2 'arg3 arg4' start`
37b7e8e
to
07014e0
Compare
07014e0
to
67fd234
Compare
src/setup/config.rs
Outdated
NodeKind::Zebra => { | ||
// Zebra's final arg must be `start`, so we insert the actual args before it. | ||
let n = start_args.len(); | ||
assert!(n > 1, "Expected at least one arg for Zebra (`start`)"); |
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.
We might actually want to return a result here instead of panicking for future proofing? (A custom runner would likely need Result
s to function properly).
feat: automated node config path args
The user previously had to specify the location of our generated config file. This change removes this requirement -- since we generate it, we should also pass on the information to the node.