diff --git a/cmd/celestia/bridge.go b/cmd/celestia/bridge.go index d51bae6d3b..c0e2ab0d1a 100644 --- a/cmd/celestia/bridge.go +++ b/cmd/celestia/bridge.go @@ -5,7 +5,6 @@ import ( "github.com/spf13/pflag" cmdnode "github.com/celestiaorg/celestia-node/cmd" - "github.com/celestiaorg/celestia-node/cmd/celestia/util" "github.com/celestiaorg/celestia-node/nodebuilder/core" "github.com/celestiaorg/celestia-node/nodebuilder/gateway" "github.com/celestiaorg/celestia-node/nodebuilder/node" @@ -43,6 +42,6 @@ var bridgeCmd = &cobra.Command{ Args: cobra.NoArgs, Short: "Manage your Bridge node", PersistentPreRunE: func(cmd *cobra.Command, args []string) error { - return util.PersistentPreRunEnv(cmd, node.Bridge, args) + return cmdnode.PersistentPreRunEnv(cmd, node.Bridge, args) }, } diff --git a/cmd/celestia/full.go b/cmd/celestia/full.go index fbb20d8619..8baff1080e 100644 --- a/cmd/celestia/full.go +++ b/cmd/celestia/full.go @@ -5,7 +5,6 @@ import ( "github.com/spf13/pflag" cmdnode "github.com/celestiaorg/celestia-node/cmd" - "github.com/celestiaorg/celestia-node/cmd/celestia/util" "github.com/celestiaorg/celestia-node/nodebuilder/core" "github.com/celestiaorg/celestia-node/nodebuilder/gateway" "github.com/celestiaorg/celestia-node/nodebuilder/header" @@ -47,6 +46,6 @@ var fullCmd = &cobra.Command{ Args: cobra.NoArgs, Short: "Manage your Full node", PersistentPreRunE: func(cmd *cobra.Command, args []string) error { - return util.PersistentPreRunEnv(cmd, node.Full, args) + return cmdnode.PersistentPreRunEnv(cmd, node.Full, args) }, } diff --git a/cmd/celestia/light.go b/cmd/celestia/light.go index b25a1ceecb..553660c5d3 100644 --- a/cmd/celestia/light.go +++ b/cmd/celestia/light.go @@ -5,7 +5,6 @@ import ( "github.com/spf13/pflag" cmdnode "github.com/celestiaorg/celestia-node/cmd" - "github.com/celestiaorg/celestia-node/cmd/celestia/util" "github.com/celestiaorg/celestia-node/nodebuilder/core" "github.com/celestiaorg/celestia-node/nodebuilder/gateway" "github.com/celestiaorg/celestia-node/nodebuilder/header" @@ -47,6 +46,6 @@ var lightCmd = &cobra.Command{ Args: cobra.NoArgs, Short: "Manage your Light node", PersistentPreRunE: func(cmd *cobra.Command, args []string) error { - return util.PersistentPreRunEnv(cmd, node.Light, args) + return cmdnode.PersistentPreRunEnv(cmd, node.Light, args) }, } diff --git a/cmd/celestia/rpc.go b/cmd/celestia/rpc.go index 6a728b4c73..8cf51fda09 100644 --- a/cmd/celestia/rpc.go +++ b/cmd/celestia/rpc.go @@ -1,7 +1,7 @@ package main import ( - "github.com/celestiaorg/celestia-node/cmd/celestia/util" + "github.com/celestiaorg/celestia-node/cmd" blob "github.com/celestiaorg/celestia-node/nodebuilder/blob/cmd" das "github.com/celestiaorg/celestia-node/nodebuilder/das/cmd" header "github.com/celestiaorg/celestia-node/nodebuilder/header/cmd" @@ -12,21 +12,21 @@ import ( ) func init() { - blob.Cmd.PersistentFlags().StringVar(util.InitURLFlag()) - das.Cmd.PersistentFlags().StringVar(util.InitURLFlag()) - header.Cmd.PersistentFlags().StringVar(util.InitURLFlag()) - p2p.Cmd.PersistentFlags().StringVar(util.InitURLFlag()) - share.Cmd.PersistentFlags().StringVar(util.InitURLFlag()) - state.Cmd.PersistentFlags().StringVar(util.InitURLFlag()) - node.Cmd.PersistentFlags().StringVar(util.InitURLFlag()) + blob.Cmd.PersistentFlags().StringVar(cmd.InitURLFlag()) + das.Cmd.PersistentFlags().StringVar(cmd.InitURLFlag()) + header.Cmd.PersistentFlags().StringVar(cmd.InitURLFlag()) + p2p.Cmd.PersistentFlags().StringVar(cmd.InitURLFlag()) + share.Cmd.PersistentFlags().StringVar(cmd.InitURLFlag()) + state.Cmd.PersistentFlags().StringVar(cmd.InitURLFlag()) + node.Cmd.PersistentFlags().StringVar(cmd.InitURLFlag()) - blob.Cmd.PersistentFlags().StringVar(util.InitAuthTokenFlag()) - das.Cmd.PersistentFlags().StringVar(util.InitAuthTokenFlag()) - header.Cmd.PersistentFlags().StringVar(util.InitAuthTokenFlag()) - p2p.Cmd.PersistentFlags().StringVar(util.InitAuthTokenFlag()) - share.Cmd.PersistentFlags().StringVar(util.InitAuthTokenFlag()) - state.Cmd.PersistentFlags().StringVar(util.InitAuthTokenFlag()) - node.Cmd.PersistentFlags().StringVar(util.InitAuthTokenFlag()) + blob.Cmd.PersistentFlags().StringVar(cmd.InitAuthTokenFlag()) + das.Cmd.PersistentFlags().StringVar(cmd.InitAuthTokenFlag()) + header.Cmd.PersistentFlags().StringVar(cmd.InitAuthTokenFlag()) + p2p.Cmd.PersistentFlags().StringVar(cmd.InitAuthTokenFlag()) + share.Cmd.PersistentFlags().StringVar(cmd.InitAuthTokenFlag()) + state.Cmd.PersistentFlags().StringVar(cmd.InitAuthTokenFlag()) + node.Cmd.PersistentFlags().StringVar(cmd.InitAuthTokenFlag()) rootCmd.AddCommand( blob.Cmd, diff --git a/cmd/celestia/util/rpc.go b/cmd/rpc.go similarity index 98% rename from cmd/celestia/util/rpc.go rename to cmd/rpc.go index f68d6cfb20..513967f0ed 100644 --- a/cmd/celestia/util/rpc.go +++ b/cmd/rpc.go @@ -1,4 +1,4 @@ -package util +package cmd import ( "context" diff --git a/cmd/celestia/util/util.go b/cmd/util.go similarity index 88% rename from cmd/celestia/util/util.go rename to cmd/util.go index 205020d3af..625685fe0b 100644 --- a/cmd/celestia/util/util.go +++ b/cmd/util.go @@ -1,4 +1,4 @@ -package util +package cmd import ( "encoding/base64" @@ -10,7 +10,6 @@ import ( "github.com/spf13/cobra" - cmdnode "github.com/celestiaorg/celestia-node/cmd" "github.com/celestiaorg/celestia-node/nodebuilder/core" "github.com/celestiaorg/celestia-node/nodebuilder/gateway" "github.com/celestiaorg/celestia-node/nodebuilder/header" @@ -79,21 +78,21 @@ func PersistentPreRunEnv(cmd *cobra.Command, nodeType node.Type, _ []string) err err error ) - ctx = cmdnode.WithNodeType(ctx, nodeType) + ctx = WithNodeType(ctx, nodeType) parsedNetwork, err := p2p.ParseNetwork(cmd) if err != nil { return err } - ctx = cmdnode.WithNetwork(ctx, parsedNetwork) + ctx = WithNetwork(ctx, parsedNetwork) // loads existing config into the environment - ctx, err = cmdnode.ParseNodeFlags(ctx, cmd, cmdnode.Network(ctx)) + ctx, err = ParseNodeFlags(ctx, cmd, Network(ctx)) if err != nil { return err } - cfg := cmdnode.NodeConfig(ctx) + cfg := NodeConfig(ctx) err = p2p.ParseFlags(cmd, &cfg.P2P) if err != nil { @@ -112,7 +111,7 @@ func PersistentPreRunEnv(cmd *cobra.Command, nodeType node.Type, _ []string) err } } - ctx, err = cmdnode.ParseMiscFlags(ctx, cmd) + ctx, err = ParseMiscFlags(ctx, cmd) if err != nil { return err } @@ -122,7 +121,7 @@ func PersistentPreRunEnv(cmd *cobra.Command, nodeType node.Type, _ []string) err state.ParseFlags(cmd, &cfg.State) // set config - ctx = cmdnode.WithNodeConfig(ctx, &cfg) + ctx = WithNodeConfig(ctx, &cfg) cmd.SetContext(ctx) return nil } diff --git a/cmd/celestia/util/util_test.go b/cmd/util_test.go similarity index 99% rename from cmd/celestia/util/util_test.go rename to cmd/util_test.go index 3bfa51396f..b6e245f3e2 100644 --- a/cmd/celestia/util/util_test.go +++ b/cmd/util_test.go @@ -1,4 +1,4 @@ -package util +package cmd import ( "testing" diff --git a/nodebuilder/blob/cmd/blob.go b/nodebuilder/blob/cmd/blob.go index 38c79e48ba..d4d585aac5 100644 --- a/nodebuilder/blob/cmd/blob.go +++ b/nodebuilder/blob/cmd/blob.go @@ -10,7 +10,7 @@ import ( "github.com/spf13/cobra" "github.com/celestiaorg/celestia-node/blob" - "github.com/celestiaorg/celestia-node/cmd/celestia/util" + util "github.com/celestiaorg/celestia-node/cmd" "github.com/celestiaorg/celestia-node/share" ) diff --git a/nodebuilder/das/cmd/das.go b/nodebuilder/das/cmd/das.go index 59e7a36036..591ce325e3 100644 --- a/nodebuilder/das/cmd/das.go +++ b/nodebuilder/das/cmd/das.go @@ -3,7 +3,7 @@ package cmd import ( "github.com/spf13/cobra" - "github.com/celestiaorg/celestia-node/cmd/celestia/util" + util "github.com/celestiaorg/celestia-node/cmd" ) func init() { diff --git a/nodebuilder/header/cmd/header.go b/nodebuilder/header/cmd/header.go index 224ec647da..7053871791 100644 --- a/nodebuilder/header/cmd/header.go +++ b/nodebuilder/header/cmd/header.go @@ -7,7 +7,7 @@ import ( "github.com/spf13/cobra" - "github.com/celestiaorg/celestia-node/cmd/celestia/util" + util "github.com/celestiaorg/celestia-node/cmd" ) func init() { diff --git a/nodebuilder/node/cmd/node.go b/nodebuilder/node/cmd/node.go index 32e0636a06..604b021067 100644 --- a/nodebuilder/node/cmd/node.go +++ b/nodebuilder/node/cmd/node.go @@ -7,7 +7,7 @@ import ( "github.com/filecoin-project/go-jsonrpc/auth" "github.com/spf13/cobra" - "github.com/celestiaorg/celestia-node/cmd/celestia/util" + util "github.com/celestiaorg/celestia-node/cmd" ) func init() { diff --git a/nodebuilder/p2p/cmd/p2p.go b/nodebuilder/p2p/cmd/p2p.go index 80026612c4..95575328c6 100644 --- a/nodebuilder/p2p/cmd/p2p.go +++ b/nodebuilder/p2p/cmd/p2p.go @@ -8,7 +8,7 @@ import ( ma2 "github.com/multiformats/go-multiaddr" "github.com/spf13/cobra" - "github.com/celestiaorg/celestia-node/cmd/celestia/util" + util "github.com/celestiaorg/celestia-node/cmd" ) type peerInfo struct { diff --git a/nodebuilder/share/cmd/share.go b/nodebuilder/share/cmd/share.go index dca455818e..80e2aa6205 100644 --- a/nodebuilder/share/cmd/share.go +++ b/nodebuilder/share/cmd/share.go @@ -9,7 +9,7 @@ import ( "github.com/celestiaorg/celestia-app/pkg/da" - "github.com/celestiaorg/celestia-node/cmd/celestia/util" + util "github.com/celestiaorg/celestia-node/cmd" "github.com/celestiaorg/celestia-node/share" ) diff --git a/nodebuilder/state/cmd/state.go b/nodebuilder/state/cmd/state.go index e7edb3f86d..44d5fa5f0f 100644 --- a/nodebuilder/state/cmd/state.go +++ b/nodebuilder/state/cmd/state.go @@ -10,7 +10,7 @@ import ( "github.com/spf13/cobra" "github.com/celestiaorg/celestia-node/blob" - "github.com/celestiaorg/celestia-node/cmd/celestia/util" + util "github.com/celestiaorg/celestia-node/cmd" "github.com/celestiaorg/celestia-node/state" )