diff options
-rw-r--r-- | README.md | 10 | ||||
-rw-r--r-- | ethereal/config.go | 20 | ||||
-rw-r--r-- | ethereal/ethereum.go | 13 | ||||
-rw-r--r-- | ethereum/config.go | 18 | ||||
-rw-r--r-- | ethereum/ethereum.go | 2 |
5 files changed, 35 insertions, 28 deletions
@@ -27,13 +27,15 @@ General command line options ``` Shared between ethereum and ethereal --genaddr Generates a new address and private key (destructive action) --p Port on which the server will accept incomming connections +-id Set the custom identifier of the client (shows up on other clients) +-port Port on which the server will accept incomming connections -upnp Enable UPnP --x Desired amount of peers --r Start JSON RPC +-maxpeer Desired amount of peers +-rpc Start JSON RPC + -dir Data directory used to store configs and databases -import Import a private key +-genaddr Generates a new address and private key (destructive action) -h This Ethereum only diff --git a/ethereal/config.go b/ethereal/config.go index 535640518..6a42663e7 100644 --- a/ethereal/config.go +++ b/ethereal/config.go @@ -5,7 +5,6 @@ import ( ) var Identifier string -var StartConsole bool //var StartMining bool var StartRpc bool @@ -19,25 +18,22 @@ var GenAddr bool var UseSeed bool var ImportKey string var ExportKey bool -var DataDir string var AssetPath string func Init() { - flag.StringVar(&Identifier, "i", "", "Custom client identifier") - flag.BoolVar(&StartConsole, "c", false, "debug and testing console") - //flag.BoolVar(&StartMining, "m", false, "start dagger mining") - flag.BoolVar(&StartRpc, "r", false, "start rpc server") - flag.BoolVar(&ShowGenesis, "g", false, "prints genesis header and exits") + flag.StringVar(&Identifier, "id", "", "Custom client identifier") + flag.StringVar(&OutboundPort, "port", "30303", "listening port") flag.BoolVar(&UseUPnP, "upnp", false, "enable UPnP support") + flag.IntVar(&MaxPeer, "maxpeer", 10, "maximum desired peers") + flag.IntVar(&RpcPort, "rpcport", 8080, "port to start json-rpc server on") + flag.BoolVar(&StartRpc, "rpc", false, "start rpc server") + flag.StringVar(&AssetPath, "asset_path", "", "absolute path to GUI assets directory") + + flag.BoolVar(&ShowGenesis, "genesis", false, "prints genesis header and exits") flag.BoolVar(&UseSeed, "seed", true, "seed peers") flag.BoolVar(&GenAddr, "genaddr", false, "create a new priv/pub key") flag.BoolVar(&ExportKey, "export", false, "export private key") - flag.IntVar(&RpcPort, "rpcport", 8080, "port to start json-rpc server on") - flag.StringVar(&OutboundPort, "p", "30303", "listening port") - flag.StringVar(&DataDir, "dir", ".ethereal", "ethereum data directory") flag.StringVar(&ImportKey, "import", "", "imports the given private key (hex)") - flag.IntVar(&MaxPeer, "x", 10, "maximum desired peers") - flag.StringVar(&AssetPath, "asset_path", "", "absolute path to GUI assets directory") flag.Parse() } diff --git a/ethereal/ethereum.go b/ethereal/ethereum.go index 2867e30d4..a7e43cd9a 100644 --- a/ethereal/ethereum.go +++ b/ethereal/ethereum.go @@ -8,9 +8,11 @@ import ( "github.com/ethereum/go-ethereum/ethereal/ui" "github.com/ethereum/go-ethereum/utils" "github.com/go-qml/qml" + "github.com/rakyll/globalconf" "log" "os" "os/signal" + "path" "runtime" ) @@ -39,7 +41,16 @@ func main() { runtime.GOMAXPROCS(runtime.NumCPU()) ethchain.InitFees() - ethutil.ReadConfig(DataDir, ethutil.LogFile|ethutil.LogStd, Identifier) + + g, err := globalconf.NewWithOptions(&globalconf.Options{ + Filename: path.Join(ethutil.ApplicationFolder(".ethereal"), "conf.ini"), + }) + if err != nil { + fmt.Println(err) + } else { + g.ParseAll() + } + ethutil.ReadConfig(".ethereal", ethutil.LogFile|ethutil.LogStd, Identifier) // Instantiated a eth stack ethereum, err := eth.New(eth.CapDefault, UseUPnP) diff --git a/ethereum/config.go b/ethereum/config.go index 5da910f2b..39dc11727 100644 --- a/ethereum/config.go +++ b/ethereum/config.go @@ -20,7 +20,6 @@ var UseSeed bool var ImportKey string var ExportKey bool var LogFile string -var DataDir string var NonInteractive bool var StartJsConsole bool var InputFile string @@ -31,22 +30,21 @@ func Init() { flag.PrintDefaults() } - flag.StringVar(&Identifier, "i", "", "custom client identifier") - flag.BoolVar(&StartMining, "m", false, "start dagger mining") - flag.BoolVar(&ShowGenesis, "g", false, "prints genesis header and exits") - flag.BoolVar(&StartRpc, "r", false, "start rpc server") + flag.StringVar(&Identifier, "id", "", "Custom client identifier") + flag.StringVar(&OutboundPort, "port", "30303", "listening port") + flag.BoolVar(&UseUPnP, "upnp", false, "enable UPnP support") + flag.IntVar(&MaxPeer, "maxpeer", 10, "maximum desired peers") flag.IntVar(&RpcPort, "rpcport", 8080, "port to start json-rpc server on") + flag.BoolVar(&StartRpc, "rpc", false, "start rpc server") + flag.BoolVar(&StartJsConsole, "js", false, "exp") + + flag.BoolVar(&StartMining, "mine", false, "start dagger mining") flag.BoolVar(&NonInteractive, "y", false, "non-interactive mode (say yes to confirmations)") - flag.BoolVar(&UseUPnP, "upnp", false, "enable UPnP support") flag.BoolVar(&UseSeed, "seed", true, "seed peers") flag.BoolVar(&GenAddr, "genaddr", false, "create a new priv/pub key") flag.BoolVar(&ExportKey, "export", false, "export private key") - flag.StringVar(&OutboundPort, "p", "30303", "listening port") flag.StringVar(&LogFile, "logfile", "", "log file (defaults to standard output)") - flag.StringVar(&DataDir, "dir", ".ethereum", "ethereum data directory") flag.StringVar(&ImportKey, "import", "", "imports the given private key (hex)") - flag.IntVar(&MaxPeer, "x", 10, "maximum desired peers") - flag.BoolVar(&StartJsConsole, "js", false, "exp") flag.Parse() diff --git a/ethereum/ethereum.go b/ethereum/ethereum.go index 34bacb7b9..7bb668235 100644 --- a/ethereum/ethereum.go +++ b/ethereum/ethereum.go @@ -59,7 +59,7 @@ func main() { lt = ethutil.LogFile | ethutil.LogStd } - ethutil.ReadConfig(DataDir, lt, Identifier) + ethutil.ReadConfig(".ethereum", lt, Identifier) logger := ethutil.Config.Log |