Skip to content

Commit

Permalink
feat(torch): flag parse
Browse files Browse the repository at this point in the history
Signed-off-by: Jose Ramon Mañes <[email protected]>
  • Loading branch information
tty47 committed Oct 26, 2023
1 parent 5b5cdb3 commit b88eaf8
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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 {
Expand All @@ -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)
}

0 comments on commit b88eaf8

Please sign in to comment.