****** these are for production settings ***********/ EnsureRoot creates the root, config, and data directories if they don't exist, and panics if it fails.
(rootDir string)
| 31 | // EnsureRoot creates the root, config, and data directories if they don't exist, |
| 32 | // and panics if it fails. |
| 33 | func EnsureRoot(rootDir string) { |
| 34 | if err := tmos.EnsureDir(rootDir, DefaultDirPerm); err != nil { |
| 35 | panic(err.Error()) |
| 36 | } |
| 37 | if err := tmos.EnsureDir(filepath.Join(rootDir, defaultConfigDir), DefaultDirPerm); err != nil { |
| 38 | panic(err.Error()) |
| 39 | } |
| 40 | if err := tmos.EnsureDir(filepath.Join(rootDir, defaultDataDir), DefaultDirPerm); err != nil { |
| 41 | panic(err.Error()) |
| 42 | } |
| 43 | |
| 44 | configFilePath := filepath.Join(rootDir, defaultConfigFilePath) |
| 45 | |
| 46 | // Write default config file if missing. |
| 47 | if !tmos.FileExists(configFilePath) { |
| 48 | writeDefaultConfigFile(configFilePath) |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | // XXX: this func should probably be called by cmd/tendermint/commands/init.go |
| 53 | // alongside the writing of the genesis.json and priv_validator.json |