Add IPC path command line flag (#1229)
This commit is contained in:
parent
802197879a
commit
4d5f808085
|
@ -36,6 +36,8 @@ var (
|
|||
configFiles configFlags
|
||||
logLevel = flag.String("log", "", `Log level, one of: "ERROR", "WARN", "INFO", "DEBUG", and "TRACE"`)
|
||||
logWithoutColors = flag.Bool("log-without-color", false, "Disables log colors")
|
||||
ipcEnabled = flag.Bool("ipc", false, "Enable IPC RPC endpoint")
|
||||
ipcFile = flag.String("ipcfile", "", "Set IPC file path")
|
||||
pprofEnabled = flag.Bool("pprof", false, "Enable runtime profiling via pprof")
|
||||
pprofPort = flag.Int("pprof-port", 52525, "Port for runtime profiling via pprof")
|
||||
version = flag.Bool("version", false, "Print version and dump configuration")
|
||||
|
@ -105,6 +107,12 @@ func main() {
|
|||
config.RegisterTopics = append(config.RegisterTopics, params.WhisperDiscv5Topic)
|
||||
}
|
||||
|
||||
// enable IPC RPC
|
||||
if *ipcEnabled {
|
||||
config.IPCEnabled = true
|
||||
config.IPCFile = *ipcFile
|
||||
}
|
||||
|
||||
// set up logging options
|
||||
setupLogging(config)
|
||||
|
||||
|
|
20
node/node.go
20
node/node.go
|
@ -5,7 +5,6 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
|
@ -128,12 +127,20 @@ func newGethNodeConfig(config *params.NodeConfig) (*node.Config, error) {
|
|||
MaxPeers: config.MaxPeers,
|
||||
MaxPendingPeers: config.MaxPendingPeers,
|
||||
},
|
||||
IPCPath: makeIPCPath(config),
|
||||
HTTPCors: nil,
|
||||
HTTPModules: config.FormatAPIModules(),
|
||||
HTTPVirtualHosts: []string{"localhost"},
|
||||
}
|
||||
|
||||
if config.IPCEnabled {
|
||||
// use well-known defaults
|
||||
if config.IPCFile == "" {
|
||||
config.IPCFile = "geth.ipc"
|
||||
}
|
||||
|
||||
nc.IPCPath = config.IPCFile
|
||||
}
|
||||
|
||||
if config.HTTPEnabled {
|
||||
nc.HTTPHost = config.HTTPHost
|
||||
nc.HTTPPort = config.HTTPPort
|
||||
|
@ -322,15 +329,6 @@ func activateShhService(stack *node.Node, config *params.NodeConfig, db *leveldb
|
|||
})
|
||||
}
|
||||
|
||||
// makeIPCPath returns IPC-RPC filename
|
||||
func makeIPCPath(config *params.NodeConfig) string {
|
||||
if !config.IPCEnabled {
|
||||
return ""
|
||||
}
|
||||
|
||||
return path.Join(config.DataDir, config.IPCFile)
|
||||
}
|
||||
|
||||
// parseNodes creates list of discover.Node out of enode strings.
|
||||
func parseNodes(enodes []string) []*discover.Node {
|
||||
var nodes []*discover.Node
|
||||
|
|
Loading…
Reference in New Issue