2
0
mirror of synced 2025-01-13 18:14:14 +00:00

46 lines
1.1 KiB
C#
Raw Normal View History

2023-09-15 12:36:35 +02:00
using Core;
namespace GethPlugin
{
public class GethPlugin : IProjectPlugin, IHasLogPrefix, IHasMetadata
{
2023-09-15 15:52:02 +02:00
private readonly GethStarter starter;
2023-09-19 13:58:45 +02:00
private readonly IPluginTools tools;
2023-09-15 12:36:35 +02:00
public GethPlugin(IPluginTools tools)
{
2023-09-15 15:52:02 +02:00
starter = new GethStarter(tools);
2023-09-19 13:58:45 +02:00
this.tools = tools;
2023-09-15 12:36:35 +02:00
}
public string LogPrefix => "(Geth) ";
public void Announce()
{
2023-09-19 13:58:45 +02:00
tools.GetLog().Log($"Loaded Geth plugin.");
2023-09-15 12:36:35 +02:00
}
public void AddMetadata(IAddMetadata metadata)
{
2023-09-19 13:58:45 +02:00
metadata.Add("gethid", GethContainerRecipe.DockerImage);
2023-09-15 12:36:35 +02:00
}
public void Decommission()
{
}
2023-09-20 10:13:29 +02:00
public GethDeployment DeployGeth(Action<IGethSetup> setup)
2023-09-15 15:52:02 +02:00
{
var startupConfig = new GethStartupConfig();
setup(startupConfig);
return starter.StartGeth(startupConfig);
}
2023-09-20 10:13:29 +02:00
public IGethNode WrapGethDeployment(GethDeployment startResult)
2023-09-19 11:51:59 +02:00
{
2023-09-20 10:13:29 +02:00
startResult = SerializeGate.Gate(startResult);
return starter.WrapGethContainer(startResult);
2023-09-19 11:51:59 +02:00
}
2023-09-15 12:36:35 +02:00
}
}