Adds option to deploy geth for public testnet.
This commit is contained in:
parent
7a6d7d787b
commit
854325f10c
|
@ -10,6 +10,7 @@ namespace GethPlugin
|
|||
public const string HttpPortTag = "http_port";
|
||||
public const string DiscoveryPortTag = "disc_port";
|
||||
public const string WsPortTag = "ws_port";
|
||||
public const string AuthRpcPortTag = "auth_rpc_port";
|
||||
public const string AccountsFilename = "accounts.csv";
|
||||
|
||||
public override string AppName => "geth";
|
||||
|
@ -26,15 +27,15 @@ namespace GethPlugin
|
|||
|
||||
private string CreateArgs(GethStartupConfig config)
|
||||
{
|
||||
var discovery = AddInternalPort(tag: DiscoveryPortTag);
|
||||
|
||||
if (config.IsMiner) AddEnvVar("ENABLE_MINER", "1");
|
||||
UnlockAccounts(0, 1);
|
||||
var httpPort = AddExposedPort(tag: HttpPortTag);
|
||||
var args = $"--http.addr 0.0.0.0 --http.port {httpPort.Number} --port {discovery.Number} --discovery.port {discovery.Number} {defaultArgs}";
|
||||
|
||||
var authRpc = AddInternalPort();
|
||||
var wsPort = AddInternalPort(tag: WsPortTag);
|
||||
var httpPort = CreateApiPort(config, tag: HttpPortTag);
|
||||
var discovery = CreateP2pPort(config, tag: DiscoveryPortTag);
|
||||
var authRpc = CreateP2pPort(config, tag: AuthRpcPortTag);
|
||||
var wsPort = CreateP2pPort(config, tag: WsPortTag);
|
||||
|
||||
var args = $"--http.addr 0.0.0.0 --http.port {httpPort.Number} --port {discovery.Number} --discovery.port {discovery.Number} {defaultArgs}";
|
||||
|
||||
if (config.BootstrapNode != null)
|
||||
{
|
||||
|
@ -57,5 +58,23 @@ namespace GethPlugin
|
|||
AddEnvVar("UNLOCK_START_INDEX", startIndex.ToString());
|
||||
AddEnvVar("UNLOCK_NUMBER", numberOfAccounts.ToString());
|
||||
}
|
||||
|
||||
private Port CreateP2pPort(GethStartupConfig config, string tag)
|
||||
{
|
||||
if (config.IsPublicTestNet)
|
||||
{
|
||||
return AddExposedPort(tag);
|
||||
}
|
||||
return AddInternalPort(tag);
|
||||
}
|
||||
|
||||
private Port CreateApiPort(GethStartupConfig config, string tag)
|
||||
{
|
||||
if (config.IsPublicTestNet)
|
||||
{
|
||||
return AddInternalPort(tag);
|
||||
}
|
||||
return AddExposedPort(tag);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
IGethSetup IsMiner();
|
||||
IGethSetup WithBootstrapNode(GethBootstrapNode node);
|
||||
IGethSetup WithName(string name);
|
||||
IGethSetup AsPublicTestNet();
|
||||
}
|
||||
|
||||
public class GethStartupConfig : IGethSetup
|
||||
|
@ -12,6 +13,7 @@
|
|||
public bool IsMiner { get; private set; }
|
||||
public GethBootstrapNode? BootstrapNode { get; private set; }
|
||||
public string? NameOverride { get; private set; }
|
||||
public bool IsPublicTestNet { get; private set; } = false;
|
||||
|
||||
public IGethSetup WithBootstrapNode(GethBootstrapNode node)
|
||||
{
|
||||
|
@ -30,6 +32,12 @@
|
|||
IsMiner = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
public IGethSetup AsPublicTestNet()
|
||||
{
|
||||
IsPublicTestNet = true;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
public class GethBootstrapNode
|
||||
|
|
Loading…
Reference in New Issue