LoadConfig loads configuration file from path.
()
| 69 | |
| 70 | // LoadConfig loads configuration file from path. |
| 71 | func (c *Config) LoadConfig() (err error) { |
| 72 | path = os.Getenv(envConfigPath) |
| 73 | if path == "" { |
| 74 | path, err = os.Getwd() |
| 75 | if err != nil { |
| 76 | return |
| 77 | } |
| 78 | if path == "/" { |
| 79 | path = "." |
| 80 | } |
| 81 | } |
| 82 | path = path + "/config.json" |
| 83 | |
| 84 | err = LoadConfig(path, c) |
| 85 | if err != nil { |
| 86 | fmt.Println("LoadConfig err", err) |
| 87 | return |
| 88 | } |
| 89 | err = c.overWrite() |
| 90 | |
| 91 | return |
| 92 | } |
| 93 | |
| 94 | func (c *Config) overWrite() (err error) { |
| 95 | ip := os.Getenv(envNodeIP) |