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

Add .recursive on config::File #35

Closed
mehcode opened this issue Jun 22, 2017 · 5 comments
Closed

Add .recursive on config::File #35

mehcode opened this issue Jun 22, 2017 · 5 comments

Comments

@mehcode
Copy link
Collaborator

mehcode commented Jun 22, 2017

Allow to control upwards recursion when searching for configuration files. The only real question is if the upwards recursion should be default true or false.

// ./config/default.toml OR ../config/default.toml 
// OR ../../config/default.toml (etc., whatever ends up matching)
File::with_name("config/default.toml").recursive(true)
@tmccombs
Copy link
Contributor

To me, I would expect "recursive" to search down the file hierarchy recursively not up. That name seems odd to me.

@mehcode
Copy link
Collaborator Author

mehcode commented Jun 24, 2017

I agree. I can't think of a good name unless I make it super long. Ideas are welcome.

@tmccombs
Copy link
Contributor

search_parents?

@mehcode
Copy link
Collaborator Author

mehcode commented Jun 24, 2017

Hmm. I could just leave this out and tell people to use something like the findup crate.

extern crate config;
extern crate findup;

fn main() {
  let settings = config::Config::default()
    .merge(config::File::from(findup::findup("config/default.toml"))
    .unwrap();
}

@mehcode
Copy link
Collaborator Author

mehcode commented Jul 30, 2017

Closing because the above solution is simple enough if that's what you want.

@mehcode mehcode closed this as completed Jul 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants