geth: added identity flag which allows to set a custom node name

This commit is contained in:
obscuren 2015-04-18 23:53:30 +02:00
parent d34e4dc5ac
commit 03b4cf74a2
2 changed files with 10 additions and 0 deletions

View File

@ -218,6 +218,7 @@ JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/Javascipt-Conso
}, },
} }
app.Flags = []cli.Flag{ app.Flags = []cli.Flag{
utils.IdentityFlag,
utils.UnlockedAccountFlag, utils.UnlockedAccountFlag,
utils.PasswordFileFlag, utils.PasswordFileFlag,
utils.BootnodesFlag, utils.BootnodesFlag,

View File

@ -89,6 +89,10 @@ var (
Usage: "Blockchain version", Usage: "Blockchain version",
Value: core.BlockChainVersion, Value: core.BlockChainVersion,
} }
IdentityFlag = cli.StringFlag{
Name: "identity",
Usage: "node name",
}
// miner settings // miner settings
MinerThreadsFlag = cli.IntFlag{ MinerThreadsFlag = cli.IntFlag{
@ -242,6 +246,11 @@ func MakeEthConfig(clientID, version string, ctx *cli.Context) *eth.Config {
// Set the log dir // Set the log dir
glog.SetLogDir(ctx.GlobalString(LogFileFlag.Name)) glog.SetLogDir(ctx.GlobalString(LogFileFlag.Name))
customName := ctx.GlobalString(IdentityFlag.Name)
if len(customName) > 0 {
clientID += "/" + customName
}
return &eth.Config{ return &eth.Config{
Name: common.MakeName(clientID, version), Name: common.MakeName(clientID, version),
DataDir: ctx.GlobalString(DataDirFlag.Name), DataDir: ctx.GlobalString(DataDirFlag.Name),