Skip to content

Commit

Permalink
fix(create-cluster): introduce new flags for wallet-key and geth-url … (
Browse files Browse the repository at this point in the history
#364)

* fix(create-cluster): introduce new flags for wallet-key and geth-url required for funding

* chore: update readme.md file and bump version to v0.13.11
  • Loading branch information
gacevicljubisa authored Nov 2, 2023
1 parent 1f6e3b0 commit bf8fde6
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 22 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,14 +184,16 @@ Command **create** creates Bee infrastructure. It has two subcommands:

```
--cluster-name string cluster name (default "default")
--geth-url string Endpoint to chain node. Required.
--help help for bee-cluster
--timeout duration timeout (default 30m0s)
--with-funding fund nodes (default true)
--wallet-key string Hex-encoded private key for the Bee node wallet. Required.
```
It is required to specify *geth-url* and *wallet-key* flags for funding Bee nodes with usage of flags or config file.
example:
```
beekeeper create bee-cluster default
beekeeper create bee-cluster --cluster-name=default
```
* k8s-namespace - creates Kubernetes namespace
Expand Down
20 changes: 7 additions & 13 deletions cmd/beekeeper/cmd/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,28 +109,22 @@ func (c *command) deleteCluster(ctx context.Context, clusterName string, cfg *co
}

func (c *command) setupCluster(ctx context.Context, clusterName string, cfg *config.Config, startCluster bool) (cluster orchestration.Cluster, err error) {
const (
optionNameChainNodeEndpoint = "geth-url"
optionNameWalletKey = "wallet-key"
)

clusterConfig, ok := cfg.Clusters[clusterName]
if !ok {
return nil, fmt.Errorf("cluster %s not defined", clusterName)
}

var chainNodeEndpoint string
if chainNodeEndpoint = c.globalConfig.GetString(optionNameChainNodeEndpoint); chainNodeEndpoint == "" {
return nil, errors.New("chain node endpoint (geth-url) not provided")
}

var walletKey string
if walletKey = c.globalConfig.GetString(optionNameWalletKey); walletKey == "" {
return nil, errors.New("wallet key not provided")
}

var fundOpts orchestration.FundingOptions

if startCluster {
if chainNodeEndpoint = c.globalConfig.GetString(optionNameChainNodeEndpoint); chainNodeEndpoint == "" {
return nil, errors.New("chain node endpoint (geth-url) not provided")
}
if walletKey = c.globalConfig.GetString(optionNameWalletKey); walletKey == "" {
return nil, errors.New("wallet key not provided")
}
fundOpts = ensureFundingDefaults(clusterConfig.Funding.Export(), c.log)
}

Expand Down
14 changes: 9 additions & 5 deletions cmd/beekeeper/cmd/create_bee_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ import (
"github.com/spf13/cobra"
)

func (c *command) initCreateBeeCluster() *cobra.Command {
const (
optionNameClusterName = "cluster-name"
optionNameTimeout = "timeout"
)
const (
optionNameClusterName = "cluster-name"
optionNameChainNodeEndpoint = "geth-url"
optionNameWalletKey = "wallet-key"
optionNameTimeout = "timeout"
)

func (c *command) initCreateBeeCluster() *cobra.Command {
cmd := &cobra.Command{
Use: "bee-cluster",
Short: "creates Bee cluster",
Expand All @@ -29,6 +31,8 @@ func (c *command) initCreateBeeCluster() *cobra.Command {
}

cmd.Flags().String(optionNameClusterName, "default", "cluster name")
cmd.Flags().String(optionNameChainNodeEndpoint, "", "Endpoint to chain node. Required.")
cmd.Flags().String(optionNameWalletKey, "", "Hex-encoded private key for the Bee node wallet. Required.")
cmd.Flags().Duration(optionNameTimeout, 30*time.Minute, "timeout")

return cmd
Expand Down
4 changes: 2 additions & 2 deletions version.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package beekeeper

var (
version = "0.13.4" // manually set semantic version number
commit string // automatically set git commit hash
version = "0.13.11" // manually set semantic version number
commit string // automatically set git commit hash

// Version TODO
Version = func() string {
Expand Down

0 comments on commit bf8fde6

Please sign in to comment.