Skip to content

Commit

Permalink
Implement ApplyEnvVars for ipfshttp Config
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Robert Ignat <robert.ignat91@gmail.com>
  • Loading branch information
roignpar committed Feb 13, 2019
1 parent 580020d commit aa5d545
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions ipfsconn/ipfshttp/config.go
Expand Up @@ -6,6 +6,8 @@ import (
"fmt"
"time"

"github.com/kelseyhightower/envconfig"

"github.com/ipfs/ipfs-cluster/config"

ma "github.com/multiformats/go-multiaddr"
Expand Down Expand Up @@ -93,8 +95,14 @@ func (cfg *Config) Default() error {
// ApplyEnvVars fills in any Config fields found
// as environment variables.
func (cfg *Config) ApplyEnvVars() error {
// doesn't read any config from env
return nil
jcfg := &jsonConfig{}

err := envconfig.Process(envConfigKey, jcfg)
if err != nil {
return err
}

return cfg.applyJSONConfig(jcfg)
}

// Validate checks that the fields of this Config have sensible values,
Expand Down

0 comments on commit aa5d545

Please sign in to comment.