From bbbf39edf329449bf5b8e8f057cf6bdd411c165c Mon Sep 17 00:00:00 2001 From: Nate Maninger Date: Mon, 8 Jan 2024 11:00:19 -0800 Subject: [PATCH] config: add omit empty --- config/config.go | 60 ++++++++++++++++++++++++------------------------ 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/config/config.go b/config/config.go index 37d43792..21ee0556 100644 --- a/config/config.go +++ b/config/config.go @@ -3,68 +3,68 @@ package config type ( // HTTP contains the configuration for the HTTP server. HTTP struct { - Address string `yaml:"address"` - Password string `yaml:"password"` + Address string `yaml:"address,omitempty"` + Password string `yaml:"password,omitempty"` } // Consensus contains the configuration for the consensus set. Consensus struct { - GatewayAddress string `yaml:"gatewayAddress"` - Bootstrap bool `yaml:"bootstrap"` + GatewayAddress string `yaml:"gatewayAddress,omitempty"` + Bootstrap bool `yaml:"bootstrap,omitempty"` Peers []string `toml:"peers,omitempty"` } // RHP2 contains the configuration for the RHP2 server. RHP2 struct { - Address string `yaml:"address"` + Address string `yaml:"address,omitempty"` } // RHP3 contains the configuration for the RHP3 server. RHP3 struct { - TCPAddress string `yaml:"tcp"` - WebSocketAddress string `yaml:"websocket"` - CertPath string `yaml:"certPath"` - KeyPath string `yaml:"keyPath"` + TCPAddress string `yaml:"tcp,omitempty"` + WebSocketAddress string `yaml:"websocket,omitempty"` + CertPath string `yaml:"certPath,omitempty"` + KeyPath string `yaml:"keyPath,omitempty"` } // LogFile configures the file output of the logger. LogFile struct { - Enabled bool `yaml:"enabled"` - Level string `yaml:"level"` // override the file log level - Format string `yaml:"format"` + Enabled bool `yaml:"enabled,omitempty"` + Level string `yaml:"level,omitempty"` // override the file log level + Format string `yaml:"format,omitempty"` // Path is the path of the log file. - Path string `yaml:"path"` + Path string `yaml:"path,omitempty"` } // StdOut configures the standard output of the logger. StdOut struct { - Level string `yaml:"level"` // override the stdout log level - Enabled bool `yaml:"enabled"` - Format string `yaml:"format"` - EnableANSI bool `yaml:"enableANSI"` //nolint:tagliatelle + Level string `yaml:"level,omitempty"` // override the stdout log level + Enabled bool `yaml:"enabled,omitempty"` + Format string `yaml:"format,omitempty"` + EnableANSI bool `yaml:"enableANSI,omitempty"` //nolint:tagliatelle } // Log contains the configuration for the logger. Log struct { // Path is the directory to store the hostd.log file. // Deprecated: use File.Path instead. - Path string `yaml:"path"` - Level string `yaml:"level"` // global log level - StdOut StdOut `yaml:"stdout"` - File LogFile `yaml:"file"` + Path string `yaml:"path,omitempty"` + Level string `yaml:"level,omitempty"` // global log level + StdOut StdOut `yaml:"stdout,omitempty"` + File LogFile `yaml:"file,omitempty"` } // Config contains the configuration for the host. Config struct { - Name string `yaml:"name"` - Directory string `yaml:"directory"` - RecoveryPhrase string `yaml:"recoveryPhrase"` - AutoOpenWebUI bool `yaml:"autoOpenWebUI"` + Name string `yaml:"name,omitempty"` + Directory string `yaml:"directory,omitempty"` + RecoveryPhrase string `yaml:"recoveryPhrase,omitempty"` + AutoOpenWebUI bool `yaml:"autoOpenWebUI,omitempty"` - HTTP HTTP `yaml:"http"` - Consensus Consensus `yaml:"consensus"` - RHP2 RHP2 `yaml:"rhp2"` - RHP3 RHP3 `yaml:"rhp3"` - Log Log `yaml:"log"` + HTTP HTTP `yaml:"http,omitempty"` + Consensus Consensus `yaml:"consensus,omitempty"` + RHP2 RHP2 `yaml:"rhp2,omitempty"` + RHP3 RHP3 `yaml:"rhp3,omitempty"` + Log Log `yaml:"log,omitempty"` } )