diff --git a/cmd/main.go b/cmd/main.go index 83ab4f5..7c13d06 100755 --- a/cmd/main.go +++ b/cmd/main.go @@ -5,17 +5,12 @@ import ( "fmt" "os" - "github.com/celestiaorg/torch/config" - handlers "github.com/celestiaorg/torch/pkg/http" - "github.com/celestiaorg/torch/pkg/k8s" - log "github.com/sirupsen/logrus" "gopkg.in/yaml.v2" -) -// Configuration variables -var ( - cfg config.MutualPeersConfig // cfg stores the mutual peers' configuration. + "github.com/celestiaorg/torch/config" + handlers "github.com/celestiaorg/torch/pkg/http" + "github.com/celestiaorg/torch/pkg/k8s" ) // ParseFlags parses the command-line flags and reads the configuration file. @@ -32,6 +27,8 @@ func ParseFlags() config.MutualPeersConfig { log.Error("Config file doesn't exist...", err) } + cfg := config.MutualPeersConfig{} + // Unmarshal the YAML into a struct err = yaml.Unmarshal(file, &cfg) if err != nil { @@ -58,7 +55,7 @@ func main() { PrintName() // Parse the command-line flags and read the configuration file log.Info("Running on namespace: ", k8s.GetCurrentNamespace()) - cfg = ParseFlags() + cfg := ParseFlags() handlers.Run(cfg) }