diff options
author | Maran <maran.hidskes@gmail.com> | 2014-06-11 18:33:11 +0800 |
---|---|---|
committer | Maran <maran.hidskes@gmail.com> | 2014-06-11 18:33:11 +0800 |
commit | e36badd744bc79c652deb3d45da1438982ec622a (patch) | |
tree | dbb2eb7e665067bb3a183311999862c1a65b1311 /ethereal | |
parent | 57e3b1b093a2533e26198e9198b85556bf362b27 (diff) | |
download | dexon-e36badd744bc79c652deb3d45da1438982ec622a.tar.gz dexon-e36badd744bc79c652deb3d45da1438982ec622a.tar.zst dexon-e36badd744bc79c652deb3d45da1438982ec622a.zip |
Reimplement -datadir flag. Implements #79
The config file is actually loaded from the folder that datadir points at
Diffstat (limited to 'ethereal')
-rw-r--r-- | ethereal/config.go | 4 | ||||
-rw-r--r-- | ethereal/ethereum.go | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/ethereal/config.go b/ethereal/config.go index 6a42663e7..2315d1435 100644 --- a/ethereal/config.go +++ b/ethereal/config.go @@ -20,6 +20,8 @@ var ImportKey string var ExportKey bool var AssetPath string +var Datadir string + func Init() { flag.StringVar(&Identifier, "id", "", "Custom client identifier") flag.StringVar(&OutboundPort, "port", "30303", "listening port") @@ -35,5 +37,7 @@ func Init() { flag.BoolVar(&ExportKey, "export", false, "export private key") flag.StringVar(&ImportKey, "import", "", "imports the given private key (hex)") + flag.StringVar(&Datadir, "datadir", ".ethereal", "specifies the datadir to use. Takes precedence over config file.") + flag.Parse() } diff --git a/ethereal/ethereum.go b/ethereal/ethereum.go index b6e1c681b..7ace16760 100644 --- a/ethereal/ethereum.go +++ b/ethereal/ethereum.go @@ -43,14 +43,14 @@ func main() { ethchain.InitFees() g, err := globalconf.NewWithOptions(&globalconf.Options{ - Filename: path.Join(ethutil.ApplicationFolder(".ethereal"), "conf.ini"), + Filename: path.Join(ethutil.ApplicationFolder(Datadir), "conf.ini"), }) if err != nil { fmt.Println(err) } else { g.ParseAll() } - ethutil.ReadConfig(".ethereal", ethutil.LogFile|ethutil.LogStd, g, Identifier) + ethutil.ReadConfig(Datadir, ethutil.LogFile|ethutil.LogStd, g, Identifier) // Instantiated a eth stack ethereum, err := eth.New(eth.CapDefault, UseUPnP) |