git-lfs/config
Taylor Blau 18cb9257f9 config: demote Fetcher, introduce Environment
Previously, to fetch data out of the `*config.Configuration` type, a reference
to a `Fetcher` was used, a-la:

```
cfg.Env.Get(...)
```

This is quite convenient, however, it forces the LFS client to implement
several methods more than once. Consider the interface:

```
type Fetcher interface {
        Get(key string) (val string)

        Bool(key string, def bool) (val bool)
        // et. al.
}
```

In order to return typed information from a configuration instance, _each_
`Fetcher` must implement its own `N` methods for `Int`, `Bool`, etc.

To remedy this, the `Environment` type was introduced. It instead _has_ a
`Fetcher`, and defines its own type conversions, like so:

```
type Environment struct {
        f Fetcher
}

func (e *Environment) Bool(key string, def bool) (val bool) { }
func (e *Environment) Int(key string, def int)   (val int) { }

// et. al.
```

Now, the `config.Configuration` type holds a reference to an `Environment`, and
all type conversion methods are defined only once, saving time, and enforcing
consistency across multiple sources.
2016-08-04 14:28:19 -06:00
..
config_netrc.go vendor: vendor dependencies in vendor/ using Glide 2016-05-23 12:10:35 -06:00
config_nix.go Major refactor to pull things into config, httputil, tools 2016-05-13 17:38:06 +01:00
config_test.go config: eradicate uses of SetAllEnv 2016-08-03 17:55:39 -06:00
config_windows.go Major refactor to pull things into config, httputil, tools 2016-05-13 17:38:06 +01:00
config.go config: demote Fetcher, introduce Environment 2016-08-04 14:28:19 -06:00
endpoint.go config.NewConfig() => config.New() 2016-07-21 17:38:44 -06:00
env_fetcher.go config: demote Fetcher, introduce Environment 2016-08-04 14:28:19 -06:00
environment_test.go config: demote Fetcher, introduce Environment 2016-08-04 14:28:19 -06:00
environment.go config: demote Fetcher, introduce Environment 2016-08-04 14:28:19 -06:00
extension_test.go lfs: use github.com/stretchr/testify for assertions 2016-05-25 10:43:10 -06:00
extension.go Major refactor to pull things into config, httputil, tools 2016-05-13 17:38:06 +01:00
fetcher_test.go config: demote Fetcher, introduce Environment 2016-08-04 14:28:19 -06:00
fetcher.go config: demote Fetcher, introduce Environment 2016-08-04 14:28:19 -06:00
filesystem.go vendor: vendor dependencies in vendor/ using Glide 2016-05-23 12:10:35 -06:00
map_fetcher.go config: demote Fetcher, introduce Environment 2016-08-04 14:28:19 -06:00
version.go release v1.3.1 2016-08-02 11:09:26 -06:00