6 cmn "github.com/tendermint/tmlibs/common"
9 /****** these are for production settings ***********/
10 func EnsureRoot(rootDir string, network string) {
11 cmn.EnsureDir(rootDir, 0700)
12 cmn.EnsureDir(rootDir+"/data", 0700)
14 configFilePath := path.Join(rootDir, "config.toml")
16 // Write default config file if missing.
17 if !cmn.FileExists(configFilePath) {
18 cmn.MustWriteFile(configFilePath, []byte(selectNetwork(network)), 0644)
22 var defaultConfigTmpl = `# This is a TOML config file.
23 # For more information, see https://github.com/toml-lang/toml
25 db_backend = "leveldb"
26 api_addr = "0.0.0.0:8888"
29 var mainNetConfigTmpl = `chain_id = "mainnet"
31 laddr = "tcp://0.0.0.0:56657"
35 var testNetConfigTmpl = `chain_id = "wisdom"
37 laddr = "tcp://0.0.0.0:56656"
41 var soloNetConfigTmpl = `chain_id = "solonet"
43 laddr = "tcp://0.0.0.0:56658"
47 // Select network seeds to merge a new string.
48 func selectNetwork(network string) string {
51 return defaultConfigTmpl + mainNetConfigTmpl
53 return defaultConfigTmpl + testNetConfigTmpl
55 return defaultConfigTmpl + soloNetConfigTmpl