2024-01-31 16:52:02 +00:00
|
|
|
|
using KubernetesWorkflow.Recipe;
|
|
|
|
|
using KubernetesWorkflow;
|
|
|
|
|
using Utils;
|
|
|
|
|
|
|
|
|
|
namespace CodexDiscordBotPlugin
|
|
|
|
|
{
|
|
|
|
|
public class RewarderBotContainerRecipe : ContainerRecipeFactory
|
|
|
|
|
{
|
|
|
|
|
public override string AppName => "discordbot-rewarder";
|
2024-04-01 12:08:30 +00:00
|
|
|
|
public override string Image => "codexstorage/codex-rewarderbot:sha-2ab84e2";
|
2024-01-31 16:52:02 +00:00
|
|
|
|
|
|
|
|
|
protected override void Initialize(StartupConfig startupConfig)
|
|
|
|
|
{
|
|
|
|
|
var config = startupConfig.Get<RewarderBotStartupConfig>();
|
|
|
|
|
|
|
|
|
|
SetSchedulingAffinity(notIn: "false");
|
|
|
|
|
|
|
|
|
|
AddEnvVar("DISCORDBOTHOST", config.DiscordBotHost);
|
|
|
|
|
AddEnvVar("DISCORDBOTPORT", config.DiscordBotPort.ToString());
|
2024-04-01 13:55:47 +00:00
|
|
|
|
AddEnvVar("INTERVALMINUTES", config.IntervalMinutes);
|
2024-01-31 16:52:02 +00:00
|
|
|
|
var offset = new DateTimeOffset(config.HistoryStartUtc);
|
|
|
|
|
AddEnvVar("CHECKHISTORY", offset.ToUnixTimeSeconds().ToString());
|
|
|
|
|
|
|
|
|
|
var gethInfo = config.GethInfo;
|
|
|
|
|
AddEnvVar("GETH_HOST", gethInfo.Host);
|
|
|
|
|
AddEnvVar("GETH_HTTP_PORT", gethInfo.Port.ToString());
|
|
|
|
|
AddEnvVar("GETH_PRIVATE_KEY", gethInfo.PrivKey);
|
|
|
|
|
AddEnvVar("CODEXCONTRACTS_MARKETPLACEADDRESS", gethInfo.MarketplaceAddress);
|
|
|
|
|
AddEnvVar("CODEXCONTRACTS_TOKENADDRESS", gethInfo.TokenAddress);
|
|
|
|
|
AddEnvVar("CODEXCONTRACTS_ABI", gethInfo.Abi);
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(config.DataPath))
|
|
|
|
|
{
|
|
|
|
|
AddEnvVar("DATAPATH", config.DataPath);
|
|
|
|
|
AddVolume(config.DataPath, 1.GB());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|