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

Support multiple configuration files #3

Open
2 of 3 tasks
thekid opened this issue Aug 22, 2016 · 0 comments
Open
2 of 3 tasks

Support multiple configuration files #3

thekid opened this issue Aug 22, 2016 · 0 comments

Comments

@thekid
Copy link
Contributor

thekid commented Aug 22, 2016

Currently, the default configuration file is loaded from alongside the binary. User configuration files in:

  • ~/.doget.yml
  • %APPDATA%\Doget\config.yml (Windows)
  • ${XDG_CONFIG_HOME-~/.config}/doget/config.yml (For XDG compliant systems)

...should also be supported; and their contents should merge with the default.

mikey179 pushed a commit that referenced this issue Aug 25, 2016
Now the default configuration also respects a .doget.yml file in
the current working directory.
Additionally this implements a check so that the same file isn't
parsed twice.
mikey179 pushed a commit that referenced this issue Aug 25, 2016
The os.Stat() call was removed in 9c49c0b, but is required to
prevent errors when one of the default config files defined in #3
does not exist.
mikey179 pushed a commit that referenced this issue Aug 25, 2016
When no single configuration source exists we can't build a map of
repositories which is used later on to translate how USE references
can be accessed. This would result in a "NoRepository" error which
would give the user a wrong hint instead of pointing out that we
can't read any of the config files.
thekid added a commit that referenced this issue Aug 25, 2016
Refactor configuration API while doing so. There are now two ways to
create Configuration instances:

* config.Default() -> The builtin supporting BitBucket and GitHub.
* config.Empty() -> An empty configuration with no repositories declared.

The configuration instances retrieved by these functions can then be
merged with files by calling Merge().

If no `-config <file>` argument is passed, the default config is used
and merged with files in the searchpath as defined in #3. If a file
is explicitely specified, it is used as single authorative source, the
search path is not checked.

See discussion in issue #5
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

1 participant