From c05792612f0517465081ee962b7184847c620ddb Mon Sep 17 00:00:00 2001 From: Alonso Rodriguez Date: Mon, 18 Oct 2021 14:54:07 +0200 Subject: [PATCH] Feature/conf (#1154) * conf information * update conf library --- config/config.go | 18 ++++++++++++++---- go.mod | 2 +- go.sum | 4 +++- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/config/config.go b/config/config.go index 4951a96d..08f626ac 100644 --- a/config/config.go +++ b/config/config.go @@ -416,8 +416,12 @@ type LogConf struct { // LoadNode loads the Node configuration from path. func LoadNode(path string, coordinator bool) (*Node, error) { - var cfg Node - err := configLibrary.LoadConfig(path, DefaultValues, &cfg) + var cfg, aux Node + err := configLibrary.SourceParamsHezNode(path, &cfg, &aux) + if err != nil { + log.Println("Error SourceParamsHezNode: ", err.Error()) + } + err = configLibrary.LoadConfig(path, DefaultValues, &cfg) if err != nil { //Split errors depending on if there is a file error, a env error or a default error if strings.Contains(err.Error(), "default") { @@ -434,13 +438,18 @@ func LoadNode(path string, coordinator bool) (*Node, error) { return nil, tracerr.Wrap(fmt.Errorf("error validating configuration file: %w", err)) } } + log.Printf("Loaded Configuration: %+v", cfg) return &cfg, nil } // LoadAPIServer loads the APIServer configuration from path. func LoadAPIServer(path string, coordinator bool) (*APIServer, error) { - var cfg APIServer - err := configLibrary.LoadConfig(path, DefaultValues, &cfg) + var cfg, aux APIServer + err := configLibrary.SourceParamsHezNode(path, &cfg, &aux) + if err != nil { + log.Println("Error SourceParamsHezNode: ", err.Error()) + } + err = configLibrary.LoadConfig(path, DefaultValues, &cfg) if err != nil { //Split errors depending on if there is a file error, a env error or a default error if strings.Contains(err.Error(), "default") { @@ -457,5 +466,6 @@ func LoadAPIServer(path string, coordinator bool) (*APIServer, error) { return nil, tracerr.Wrap(fmt.Errorf("error validating configuration file: %w", err)) } } + log.Printf("Loaded Configuration: %+v", cfg) return &cfg, nil } diff --git a/go.mod b/go.mod index 39f38cc0..96109dbf 100644 --- a/go.mod +++ b/go.mod @@ -15,7 +15,7 @@ require ( github.com/gin-contrib/cors v1.3.1 github.com/gin-gonic/gin v1.7.2 github.com/gobuffalo/packr/v2 v2.8.1 - github.com/hermeznetwork/go-hermez-config v0.0.0-20210811071123-bf147fbf457c + github.com/hermeznetwork/go-hermez-config v0.0.0-20211014101826-b847060661cc github.com/hermeznetwork/tracerr v0.3.1-0.20210120162744-5da60b576169 github.com/iden3/go-iden3-crypto v0.0.6-0.20210308142348-8f85683b2cef github.com/iden3/go-merkletree v0.0.0-20210308143313-8b63ca866189 diff --git a/go.sum b/go.sum index 9e2aeee2..07d48809 100644 --- a/go.sum +++ b/go.sum @@ -479,6 +479,8 @@ github.com/hermeznetwork/go-hermez-config v0.0.0-20210811071123-bf147fbf457c h1: github.com/hermeznetwork/go-hermez-config v0.0.0-20210811071123-bf147fbf457c/go.mod h1:oP5l93YlYArOFlp9t65C8+zDijAyDAurMY4gkkjFkwY= github.com/hermeznetwork/go-hermez-config v0.0.0-20210811083017-293d54cc5c47 h1:Y9/fFEZZ1yuZKfBnT4zNkmx7vBKpnNhQy6NuKw4K6MI= github.com/hermeznetwork/go-hermez-config v0.0.0-20210811083017-293d54cc5c47/go.mod h1:oP5l93YlYArOFlp9t65C8+zDijAyDAurMY4gkkjFkwY= +github.com/hermeznetwork/go-hermez-config v0.0.0-20211014101826-b847060661cc h1:8Sptuojy79wDa8htKlNGqyXD/KSharDS4gJjqXwNUgk= +github.com/hermeznetwork/go-hermez-config v0.0.0-20211014101826-b847060661cc/go.mod h1:oP5l93YlYArOFlp9t65C8+zDijAyDAurMY4gkkjFkwY= github.com/hermeznetwork/tracerr v0.3.1-0.20210120162744-5da60b576169 h1:I7zgVVlOgf+26yrrKKY9UT+9f73qqlNBGX6C9MPXnk4= github.com/hermeznetwork/tracerr v0.3.1-0.20210120162744-5da60b576169/go.mod h1:nsWC1+tc4qUEbUGRv4DcPJJTjLsedlPajlFmpJoohK4= github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao= @@ -902,7 +904,6 @@ github.com/markbates/oncer v1.0.0 h1:E83IaVAHygyndzPimgUYJjbshhDTALZyXxvk9FOlQRY github.com/markbates/oncer v1.0.0/go.mod h1:Z59JA581E9GP6w96jai+TGqafHPW+cPfRxz2aSZ0mcI= github.com/markbates/safe v1.0.1 h1:yjZkbvRM6IzKj9tlu/zMJLS0n/V351OZWRnF3QfaUxI= github.com/markbates/safe v1.0.1/go.mod h1:nAqgmRi7cY2nqMc92/bSEeQA+R4OheNU2T1kNSCBdG0= -github.com/matryer/is v1.4.0/go.mod h1:8I/i5uYgLzgsgEloJE1U6xx5HkBQpAZvepWuujKwMRU= github.com/marten-seemann/qpack v0.2.1/go.mod h1:F7Gl5L1jIgN1D11ucXefiuJS9UMVP2opoCp2jDKb7wc= github.com/marten-seemann/qtls v0.10.0 h1:ECsuYUKalRL240rRD4Ri33ISb7kAQ3qGDlrrl55b2pc= github.com/marten-seemann/qtls v0.10.0/go.mod h1:UvMd1oaYDACI99/oZUYLzMCkBXQVT0aGm99sJhbT8hs= @@ -910,6 +911,7 @@ github.com/marten-seemann/qtls-go1-15 v0.1.1 h1:LIH6K34bPVttyXnUWixk0bzH6/N07Vxb github.com/marten-seemann/qtls-go1-15 v0.1.1/go.mod h1:GyFwywLKkRt+6mfU99csTEY1joMZz5vmB1WNZH3P81I= github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd h1:br0buuQ854V8u83wA0rVZ8ttrq5CpaPZdvrK0LP2lOk= github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd/go.mod h1:QuCEs1Nt24+FYQEqAAncTDPJIuGs+LxK1MCiFL25pMU= +github.com/matryer/is v1.4.0/go.mod h1:8I/i5uYgLzgsgEloJE1U6xx5HkBQpAZvepWuujKwMRU= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.0/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ=