OSDN Git Service

update init (#276)
authorChengcheng Zhang <943420582@qq.com>
Sat, 13 Jul 2019 02:56:13 +0000 (10:56 +0800)
committerPaladz <yzhu101@uottawa.ca>
Sat, 13 Jul 2019 02:56:13 +0000 (10:56 +0800)
* update init

* update

* update fatal

cmd/vapord/commands/init.go

index 31c16a3..aa0f144 100644 (file)
@@ -28,7 +28,7 @@ func init() {
 func initFiles(cmd *cobra.Command, args []string) {
        configFilePath := path.Join(config.RootDir, "config.toml")
        if _, err := os.Stat(configFilePath); !os.IsNotExist(err) {
 func initFiles(cmd *cobra.Command, args []string) {
        configFilePath := path.Join(config.RootDir, "config.toml")
        if _, err := os.Stat(configFilePath); !os.IsNotExist(err) {
-               log.WithFields(log.Fields{"module": logModule, "config": configFilePath}).Panic("Already exists config file.")
+               log.WithFields(log.Fields{"module": logModule, "config": configFilePath}).Fatal("Already exists config file.")
        }
 
        switch config.ChainID {
        }
 
        switch config.ChainID {
@@ -44,7 +44,7 @@ func initFiles(cmd *cobra.Command, args []string) {
        fedFilePath := config.FederationFile()
        if _, err := os.Stat(fedFilePath); os.IsNotExist(err) {
                if err := cfg.ExportFederationFile(fedFilePath, config); err != nil {
        fedFilePath := config.FederationFile()
        if _, err := os.Stat(fedFilePath); os.IsNotExist(err) {
                if err := cfg.ExportFederationFile(fedFilePath, config); err != nil {
-                       log.WithFields(log.Fields{"module": logModule, "config": fedFilePath, "error": err}).Panic("fail on export federation file")
+                       log.WithFields(log.Fields{"module": logModule, "config": fedFilePath, "error": err}).Fatal("fail on export federation file")
                }
        }
 
                }
        }
 
@@ -53,11 +53,11 @@ func initFiles(cmd *cobra.Command, args []string) {
        if _, err := os.Stat(keyFilePath); os.IsNotExist(err) {
                xprv, err := chainkd.NewXPrv(nil)
                if err != nil {
        if _, err := os.Stat(keyFilePath); os.IsNotExist(err) {
                xprv, err := chainkd.NewXPrv(nil)
                if err != nil {
-                       log.WithFields(log.Fields{"module": logModule, "err": err}).Panic("fail on generate private key")
+                       log.WithFields(log.Fields{"module": logModule, "err": err}).Fatal("fail on generate private key")
                }
 
                if err := ioutil.WriteFile(keyFilePath, []byte(hex.EncodeToString(xprv[:])), 0600); err != nil {
                }
 
                if err := ioutil.WriteFile(keyFilePath, []byte(hex.EncodeToString(xprv[:])), 0600); err != nil {
-                       log.WithFields(log.Fields{"module": logModule, "err": err}).Panic("fail on save private key")
+                       log.WithFields(log.Fields{"module": logModule, "err": err}).Fatal("fail on save private key")
                }
 
                log.WithFields(log.Fields{"pubkey": xprv.XPub()}).Info("success generate private")
                }
 
                log.WithFields(log.Fields{"pubkey": xprv.XPub()}).Info("success generate private")