arnaucube
arnaucube/hermez-nodePublic Self-hosted repository
Set gin debug mode via config

Add new config setting `Debug.GinDebugMode`.  When set to true, gin will run in
debug mode.  If not set, gin will run in release mode.  Before this change, gin
always ran in debug mode, so to keep the same behaviour as before, set this
parameter to true
Eduard S eduard@iden3.io
Thu, 25 Feb 2021 15:49:43 +0100
commit

ba108b11465e986f89d63626b0d97eb906a1e439

parent

706e4c7a3d4d896bde998d725612ca73ad45092a

3 files changed, 9 insertions(+), 0 deletions(-)

jump to
M cli/node/cfg.buidler.toml → cli/node/cfg.buidler.toml

@@ -14,6 +14,7 @@

[Debug] APIAddress = "localhost:12345" MeddlerLogs = true +GinDebugMode = true [StateDB] Path = "/tmp/iden3-test/hermez/statedb"
M config/config.go → config/config.go

@@ -294,6 +294,9 @@ APIAddress string

// MeddlerLogs enables meddler debug mode, where unused columns and struct // fields will be logged MeddlerLogs bool + // GinDebugMode sets Gin-Gonic (the web framework) to run in + // debug mode + GinDebugMode bool } Coordinator Coordinator `validate:"-"` }
M node/node.go → node/node.go

@@ -358,6 +358,11 @@ }

} var nodeAPI *NodeAPI if cfg.API.Address != "" { + if cfg.Debug.GinDebugMode { + gin.SetMode(gin.DebugMode) + } else { + gin.SetMode(gin.ReleaseMode) + } if cfg.API.UpdateMetricsInterval.Duration == 0 { return nil, tracerr.Wrap(fmt.Errorf("invalid cfg.API.UpdateMetricsInterval: %v", cfg.API.UpdateMetricsInterval.Duration))