2
0
mirror of synced 2025-01-13 01:54:07 +00:00

48 lines
1.8 KiB
C#
Raw Normal View History

2023-10-24 10:06:07 +02:00
using KubernetesWorkflow;
using KubernetesWorkflow.Recipe;
2023-10-25 11:53:33 +02:00
using Utils;
2023-10-24 10:06:07 +02:00
namespace CodexDiscordBotPlugin
{
public class DiscordBotContainerRecipe : ContainerRecipeFactory
{
public override string AppName => "discordbot-bibliotech";
2024-06-25 13:02:05 +02:00
public override string Image => "codexstorage/codex-discordbot:sha-8033da1";
2023-10-24 10:06:07 +02:00
2024-02-19 09:11:36 +01:00
public static string RewardsPort = "bot_rewards_port";
2023-10-24 10:06:07 +02:00
protected override void Initialize(StartupConfig startupConfig)
{
var config = startupConfig.Get<DiscordBotStartupConfig>();
SetSchedulingAffinity(notIn: "false");
2023-10-24 10:06:07 +02:00
AddEnvVar("TOKEN", config.Token);
AddEnvVar("SERVERNAME", config.ServerName);
AddEnvVar("ADMINROLE", config.AdminRoleName);
AddEnvVar("ADMINCHANNELNAME", config.AdminChannelName);
2024-02-19 09:11:36 +01:00
AddEnvVar("REWARDSCHANNELNAME", config.RewardChannelName);
AddEnvVar("KUBECONFIG", "/opt/kubeconfig.yaml");
AddEnvVar("KUBENAMESPACE", config.KubeNamespace);
2023-10-25 11:53:33 +02:00
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);
2024-05-20 16:18:01 +02:00
AddEnvVar("NODISCORD", "1");
2024-02-19 09:11:36 +01:00
AddInternalPortAndVar("REWARDAPIPORT", RewardsPort);
if (!string.IsNullOrEmpty(config.DataPath))
2023-10-25 11:53:33 +02:00
{
AddEnvVar("DATAPATH", config.DataPath);
AddVolume(config.DataPath, 1.GB());
}
2023-10-24 10:06:07 +02:00
}
}
}