Combine default values used at initialization in a trait (#6857)

This moves default values used in the Substrate code base when
initializing a service into a common trait. Currently this trait only
contains listen ports, but this could be extended in the future.
Essentially this will make overriding these values much easier for
Cumulus, where we have 2 nodes running in one binary.
This commit is contained in:
Bastian Köcher
2020-08-19 17:30:56 +02:00
committed by GitHub
parent 52e55daeef
commit 7bf838f225
5 changed files with 94 additions and 39 deletions
@@ -114,8 +114,9 @@ impl NetworkParams {
client_id: &str,
node_name: &str,
node_key: NodeKeyConfig,
default_listen_port: u16,
) -> NetworkConfiguration {
let port = self.port.unwrap_or(30333);
let port = self.port.unwrap_or(default_listen_port);
let listen_addresses = if self.listen_addr.is_empty() {
vec![