-
Notifications
You must be signed in to change notification settings - Fork 14
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: config file #20
Conversation
Signed-off-by: Berend Sliedrecht <[email protected]>
b56ac7c
to
e150b6e
Compare
Signed-off-by: Berend Sliedrecht <[email protected]>
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 a few knitpicks but nice job!
@@ -23,10 +23,17 @@ async fn main() { | |||
// Get all the supplied flags and values | |||
let matches = App::from_yaml(yaml).get_matches(); | |||
|
|||
// Takes a path, but prepends the home directory... kinda sketchy | |||
let endpoint_from_config = | |||
utils::config::get_value("/.config/accf/ex.ini", "Default", "endpoint"); |
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.
Maybe this should be tested for/extended to non-MacOS also
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.
frick windows.
None => error::throw(error::Error::InvalidEndpoint), | ||
None => match endpoint_from_config { | ||
Some(e) => HttpAgent::new(e.as_str()), | ||
None => error::throw(error::Error::NoSuppliedEndpoint), |
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.
Maybe this could be another custom error that is more specific here. Maybe sth like:
NoSuppliedEndpointInConfig
so the user knows that it's been looked for in config (after not having had a CLI flag)
Some(c) => get_value_by_key(key, &c), | ||
None => None, | ||
} | ||
} |
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.
nice!
closes #11