filter out defined variables in error
This commit is contained in:
parent
924d9d4df7
commit
8c63f40f56
14
envconf.go
14
envconf.go
@ -104,12 +104,14 @@ func (c *Config) Parse() {
|
|||||||
}
|
}
|
||||||
for k, v := range c.env {
|
for k, v := range c.env {
|
||||||
if failed && (v.parsed.err == nil) {
|
if failed && (v.parsed.err == nil) {
|
||||||
if v.unset {
|
if v.empty {
|
||||||
v.parsed.err = errors.New(fmt.Sprintf(`Environment variable "%s" not found. It should have been of type %s.`, k, v.dtype))
|
if v.unset {
|
||||||
c.env[k] = v
|
v.parsed.err = errors.New(fmt.Sprintf(`Environment variable "%s" not found. It should have been of type %s.`, k, v.dtype))
|
||||||
} else {
|
c.env[k] = v
|
||||||
v.parsed.err = errors.New(fmt.Sprintf(`Environment variable "%s" not found. Default value of "%s"(%s) used.`, k, v.value, v.dtype))
|
} else {
|
||||||
c.env[k] = v
|
v.parsed.err = errors.New(fmt.Sprintf(`Environment variable "%s" not found. Default value of "%s"(%s) used.`, k, v.value, v.dtype))
|
||||||
|
c.env[k] = v
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user