cmd/swarm: Add --httpaddr flag (#14475)

Fixes #14474.

Signed-off-by: Lewis Marshall <lewis@lmars.net>
This commit is contained in:
Lewis Marshall
2017-05-21 23:56:40 -07:00
committed by Jeffrey Wilcke
parent bc75351edf
commit 4a2c17b1ab
5 changed files with 30 additions and 19 deletions

View File

@ -32,7 +32,8 @@ import (
)
const (
port = "8500"
DefaultHTTPListenAddr = "127.0.0.1"
DefaultHTTPPort = "8500"
)
var (
@ -48,12 +49,13 @@ type Config struct {
*network.HiveParams
Swap *swap.SwapParams
*network.SyncParams
Path string
Port string
PublicKey string
BzzKey string
EnsRoot common.Address
NetworkId uint64
Path string
ListenAddr string
Port string
PublicKey string
BzzKey string
EnsRoot common.Address
NetworkId uint64
}
// config is agnostic to where private key is coming from
@ -76,7 +78,8 @@ func NewConfig(path string, contract common.Address, prvKey *ecdsa.PrivateKey, n
HiveParams: network.NewHiveParams(dirpath),
ChunkerParams: storage.NewChunkerParams(),
StoreParams: storage.NewStoreParams(dirpath),
Port: port,
ListenAddr: DefaultHTTPListenAddr,
Port: DefaultHTTPPort,
Path: dirpath,
Swap: swap.DefaultSwapParams(contract, prvKey),
PublicKey: pubkeyhex,

View File

@ -80,6 +80,7 @@ var (
false
],
"Path": "TMPDIR",
"ListenAddr": "127.0.0.1",
"Port": "8500",
"PublicKey": "0x045f5cfd26692e48d0017d380349bcf50982488bc11b5145f3ddf88b24924299048450542d43527fbe29a5cb32f38d62755393ac002e6bfdd71b8d7ba725ecd7a3",
"BzzKey": "0xe861964402c0b78e2d44098329b8545726f215afa737d803714a4338552fcb81",

View File

@ -69,7 +69,6 @@ func StartHttpServer(api *api.Api, config *ServerConfig) {
hdlr := c.Handler(NewServer(api))
go http.ListenAndServe(config.Addr, hdlr)
log.Info(fmt.Sprintf("Swarm HTTP proxy started on localhost:%s", config.Addr))
}
func NewServer(api *api.Api) *Server {