cmd/swarm: make bzzaccount flag optional and add bzzkeyhex flag (#1531)
* cmd/swarm: don't require bzzaccount flag * docker: remove setup script because bzzaccount is not required anymore * cmd/swarm: manage account creation/selection when bzzflag is not defined * cmd/swarm: no bzzaccount flag tests * cmd/swarm: use random network ports on tests * cmd/swarm: fix typo * cmd/swarm: add --bzzkeyhex flag * cmd/swarm: use different ipc paths for tests * readme: update example on how to run swarm * cmd/swarm: rename getAccount -> getOrCreateAccount * cmd/swarm: remove unneeded comment * cmd/swarm: use shorter ipc path for test
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"crypto/ecdsa"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
@@ -60,6 +61,7 @@ var (
|
||||
const (
|
||||
SwarmEnvChequebookAddr = "SWARM_CHEQUEBOOK_ADDR"
|
||||
SwarmEnvAccount = "SWARM_ACCOUNT"
|
||||
SwarmEnvBzzKeyHex = "SWARM_BZZ_KEY_HEX"
|
||||
SwarmEnvListenAddr = "SWARM_LISTEN_ADDR"
|
||||
SwarmEnvPort = "SWARM_PORT"
|
||||
SwarmEnvNetworkID = "SWARM_NETWORK_ID"
|
||||
@@ -121,9 +123,9 @@ func buildConfig(ctx *cli.Context) (config *bzzapi.Config, err error) {
|
||||
|
||||
//finally, after the configuration build phase is finished, initialize
|
||||
func initSwarmNode(config *bzzapi.Config, stack *node.Node, ctx *cli.Context, nodeconfig *node.Config) error {
|
||||
//at this point, all vars should be set in the Config
|
||||
//get the account for the provided swarm account
|
||||
prvkey := getAccount(config.BzzAccount, ctx, stack)
|
||||
var prvkey *ecdsa.PrivateKey
|
||||
config.BzzAccount, prvkey = getOrCreateAccount(ctx, stack)
|
||||
//set the resolved config path (geth --datadir)
|
||||
config.Path = expandPath(stack.InstanceDir())
|
||||
//finally, initialize the configuration
|
||||
|
Reference in New Issue
Block a user