2
0
mirror of synced 2025-01-29 09:45:02 +00:00

33 lines
1.2 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";
public override string Image => "thatbenbierens/codex-discordbot:initial";
protected override void Initialize(StartupConfig startupConfig)
{
var config = startupConfig.Get<DiscordBotStartupConfig>();
AddEnvVar("TOKEN", config.Token);
AddEnvVar("SERVERNAME", config.ServerName);
AddEnvVar("ADMINROLE", config.AdminRoleName);
AddEnvVar("ADMINCHANNELNAME", config.AdminChannelName);
AddEnvVar("KUBECONFIG", "/opt/kubeconfig.yaml");
AddEnvVar("KUBENAMESPACE", config.KubeNamespace);
2023-10-25 11:53:33 +02:00
if (!string.IsNullOrEmpty(config.DataPath))
2023-10-25 11:53:33 +02:00
{
AddEnvVar("DATAPATH", config.DataPath);
AddVolume(config.DataPath, 1.GB());
}
2023-11-08 11:59:31 +01:00
AddVolume(name: "kubeconfig", mountPath: "/opt/kubeconfig.yaml", subPath: "kubeconfig.yaml", secret: "discordbot-sa-kubeconfig");
2023-10-24 10:06:07 +02:00
}
}
}