Reimplement -datadir flag. Implements #79
The config file is actually loaded from the folder that datadir points at
This commit is contained in:
@@ -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()
|
||||
}
|
||||
|
@@ -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)
|
||||
|
Reference in New Issue
Block a user