From e36badd744bc79c652deb3d45da1438982ec622a Mon Sep 17 00:00:00 2001 From: Maran Date: Wed, 11 Jun 2014 12:33:11 +0200 Subject: Reimplement -datadir flag. Implements #79 The config file is actually loaded from the folder that datadir points at --- ethereum/config.go | 4 ++++ ethereum/ethereum.go | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'ethereum') diff --git a/ethereum/config.go b/ethereum/config.go index 39dc11727..a80b47a8e 100644 --- a/ethereum/config.go +++ b/ethereum/config.go @@ -24,6 +24,8 @@ var NonInteractive bool var StartJsConsole bool var InputFile string +var Datadir string + func Init() { flag.Usage = func() { fmt.Fprintf(os.Stderr, "%s [options] [filename]:\n", os.Args[0]) @@ -46,6 +48,8 @@ func Init() { flag.StringVar(&LogFile, "logfile", "", "log file (defaults to standard output)") flag.StringVar(&ImportKey, "import", "", "imports the given private key (hex)") + flag.StringVar(&Datadir, "datadir", ".ethereum", "specifies the datadir to use. Takes precedence over config file.") + flag.Parse() InputFile = flag.Arg(0) diff --git a/ethereum/ethereum.go b/ethereum/ethereum.go index 56ea46122..179a3f462 100644 --- a/ethereum/ethereum.go +++ b/ethereum/ethereum.go @@ -62,14 +62,14 @@ func main() { } g, err := globalconf.NewWithOptions(&globalconf.Options{ - Filename: path.Join(ethutil.ApplicationFolder(".ethereum"), "conf.ini"), + Filename: path.Join(ethutil.ApplicationFolder(Datadir), "conf.ini"), }) if err != nil { fmt.Println(err) } else { g.ParseAll() } - ethutil.ReadConfig(".ethereum", lt, g, Identifier) + ethutil.ReadConfig(Datadir, lt, g, Identifier) logger := ethutil.Config.Log -- cgit