()
| 308 | } |
| 309 | |
| 310 | func (n *Node) replaceConfigTOML() error { |
| 311 | config, err := n.parseConfigTOML() |
| 312 | if err != nil { |
| 313 | return err |
| 314 | } |
| 315 | |
| 316 | file, err := os.Create(n.CLI.ConfigFilePath()) |
| 317 | if err != nil { |
| 318 | return err |
| 319 | } |
| 320 | |
| 321 | if !n.Standalone { |
| 322 | addressList := []string{n.PeerAddress} |
| 323 | config.P2P.PersistentPeers = strings.Join(addressList[:], ",") |
| 324 | } |
| 325 | |
| 326 | if n.IPAddr != "" { |
| 327 | config.P2P.ExternalAddress = fmt.Sprintf("%v:%v", n.IPAddr, common.P2PPort) |
| 328 | } |
| 329 | |
| 330 | config.RPC.CorsAllowedOrigins = []string{"*"} |
| 331 | config.RPC.CorsAllowedHeaders = []string{"*"} |
| 332 | config.P2P.MaxNumInboundPeers = common.MaxNumInboundPeers |
| 333 | config.P2P.MaxNumOutboundPeers = common.MaxNumOutboundPeers |
| 334 | config.P2P.AllowDuplicateIP = common.AllowDuplicateIP |
| 335 | |
| 336 | if err := toml.NewEncoder(file).Encode(config); err != nil { |
| 337 | return err |
| 338 | } |
| 339 | |
| 340 | if err := file.Close(); err != nil { |
| 341 | return err |
| 342 | } |
| 343 | |
| 344 | return nil |
| 345 | } |
| 346 | |
| 347 | func (n *Node) replaceAppTOML() error { |
| 348 | config, err := n.parseAppTOML() |
no test coverage detected