Skip to content
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

Merged
merged 2 commits into from
Dec 15, 2021
Merged

feat: config file #20

merged 2 commits into from
Dec 15, 2021

Conversation

berendsliedrecht
Copy link
Member

@berendsliedrecht berendsliedrecht commented Dec 10, 2021

  • feat: config file

closes #11

Signed-off-by: Berend Sliedrecht <[email protected]>
Signed-off-by: Berend Sliedrecht <[email protected]>
@berendsliedrecht berendsliedrecht changed the title feat/config file feat: config file Dec 11, 2021
@morrieinmaas morrieinmaas self-requested a review December 14, 2021 15:24
Copy link
Contributor

@morrieinmaas morrieinmaas left a 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");
Copy link
Contributor

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

Copy link
Member Author

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),
Copy link
Contributor

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,
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

@berendsliedrecht berendsliedrecht merged commit 10fcd2e into main Dec 15, 2021
@berendsliedrecht berendsliedrecht deleted the feat/config-file branch December 15, 2021 08:13
gitbook-com bot pushed a commit that referenced this pull request Apr 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Default config file
2 participants