OSDN Git Service

Merge pull request #935 from Bytom/dev
[bytom/bytom.git] / config / config.go
index 9f11feb..5fe31e6 100644 (file)
@@ -81,7 +81,12 @@ type BaseConfig struct {
 
        ApiAddress string `mapstructure:"api_addr"`
 
+       VaultMode bool `mapstructure:"vault_mode"`
+
        Time time.Time
+
+       // log file name
+       LogName string `mapstructure:"log_name"`
 }
 
 // Default configurable base parameters.
@@ -97,6 +102,7 @@ func DefaultBaseConfig() BaseConfig {
                DBPath:            "data",
                KeysPath:          "keystore",
                HsmUrl:            "",
+               LogName:           "bytom.log",
        }
 }
 
@@ -143,6 +149,7 @@ func (p *P2PConfig) AddrBookFile() string {
 //-----------------------------------------------------------------------------
 type WalletConfig struct {
        Disable bool `mapstructure:"disable"`
+       Rescan  bool `mapstructure:"rescan"`
 }
 
 type RPCAuthConfig struct {
@@ -171,6 +178,7 @@ func DefaultWebConfig() *WebConfig {
 func DefaultWalletConfig() *WalletConfig {
        return &WalletConfig{
                Disable: false,
+               Rescan:  false,
        }
 }
 
@@ -190,18 +198,17 @@ func rootify(path, root string) string {
 func DefaultDataDir() string {
        // Try to place the data folder in the user's home dir
        home := homeDir()
-       dataDir := "./.Bytom"
-       if home != "" {
-               switch runtime.GOOS {
-               case "darwin":
-                       dataDir = filepath.Join(home, "Library", "Bytom")
-               case "windows":
-                       dataDir = filepath.Join(home, "AppData", "Roaming", "Bytom")
-               default:
-                       dataDir = filepath.Join(home, ".Bytom")
-               }
+       if home == "" {
+               return "./.bytom"
+       }
+       switch runtime.GOOS {
+       case "darwin":
+               return filepath.Join(home, "Library", "Bytom")
+       case "windows":
+               return filepath.Join(home, "AppData", "Roaming", "Bytom")
+       default:
+               return filepath.Join(home, ".bytom")
        }
-       return dataDir
 }
 
 func homeDir() string {