Set envconfig version (more or less), and move setDefaults down a bit.
License: MIT Signed-off-by: Hector Sanjuan <code@hector.link>
This commit is contained in:
parent
3ab3c2afa0
commit
0b923f8d49
|
@ -273,8 +273,6 @@ func (cfg *Config) setDefaults() {
|
||||||
// sets the Config fields from it. Note that it should be JSON
|
// sets the Config fields from it. Note that it should be JSON
|
||||||
// as generated by ToJSON().
|
// as generated by ToJSON().
|
||||||
func (cfg *Config) LoadJSON(raw []byte) error {
|
func (cfg *Config) LoadJSON(raw []byte) error {
|
||||||
cfg.setDefaults()
|
|
||||||
|
|
||||||
jcfg := &configJSON{}
|
jcfg := &configJSON{}
|
||||||
err := json.Unmarshal(raw, jcfg)
|
err := json.Unmarshal(raw, jcfg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -282,6 +280,8 @@ func (cfg *Config) LoadJSON(raw []byte) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cfg.setDefaults()
|
||||||
|
|
||||||
if jcfg.Peers != nil || jcfg.Bootstrap != nil {
|
if jcfg.Peers != nil || jcfg.Bootstrap != nil {
|
||||||
logger.Error(`
|
logger.Error(`
|
||||||
Your configuration is using cluster.Peers and/or cluster.Bootstrap
|
Your configuration is using cluster.Peers and/or cluster.Bootstrap
|
||||||
|
|
|
@ -152,9 +152,9 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"author": "lanzafame",
|
"author": "lanzafame",
|
||||||
"hash": "QmVPrFJ6dYJyt7uULgE7wouhvXDzYBZVjYvjMCE5Uqxgfy",
|
"hash": "QmYgGtLm9WJRgh6iuaZap8qVC1gqixFbZCNfhjLNBhWMCm",
|
||||||
"name": "envconfig",
|
"name": "envconfig",
|
||||||
"version": "0.0.0"
|
"version": "1.3.1"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"gxVersion": "0.11.0",
|
"gxVersion": "0.11.0",
|
||||||
|
|
Loading…
Reference in New Issue
Block a user