Sets up bot container recipe
This commit is contained in:
parent
b74349cc68
commit
d4522f0d9c
|
@ -28,9 +28,18 @@ namespace CodexDiscordBotPlugin
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public RunningContainer Deploy()
|
public RunningContainer Deploy(DiscordBotStartupConfig config)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
var workflow = tools.CreateWorkflow();
|
||||||
|
var startupConfig = new StartupConfig();
|
||||||
|
startupConfig.NameOverride = config.Name;
|
||||||
|
startupConfig.Add(config);
|
||||||
|
var rc = workflow.Start(1, new DiscordBotContainerRecipe(), startupConfig);
|
||||||
|
|
||||||
|
// write deployment into endpoints folder.
|
||||||
|
|
||||||
|
|
||||||
|
return rc.Containers.Single();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,9 +5,9 @@ namespace CodexDiscordBotPlugin
|
||||||
{
|
{
|
||||||
public static class CoreInterfaceExtensions
|
public static class CoreInterfaceExtensions
|
||||||
{
|
{
|
||||||
public static RunningContainer DeployMetricsCollector(this CoreInterface ci)
|
public static RunningContainer DeployMetricsCollector(this CoreInterface ci, DiscordBotStartupConfig config)
|
||||||
{
|
{
|
||||||
return Plugin(ci).Deploy();
|
return Plugin(ci).Deploy(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static CodexDiscordBotPlugin Plugin(CoreInterface ci)
|
private static CodexDiscordBotPlugin Plugin(CoreInterface ci)
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
using KubernetesWorkflow;
|
||||||
|
|
||||||
|
namespace CodexDiscordBotPlugin
|
||||||
|
{
|
||||||
|
public class DiscordBotContainerRecipe : ContainerRecipeFactory
|
||||||
|
{
|
||||||
|
public const string EndpointsPath = "/var/endpoints";
|
||||||
|
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("ENDPOINTS", EndpointsPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
using CodexPlugin;
|
||||||
|
|
||||||
|
namespace CodexDiscordBotPlugin
|
||||||
|
{
|
||||||
|
public class DiscordBotStartupConfig
|
||||||
|
{
|
||||||
|
public DiscordBotStartupConfig(string name, string token, string serverName, string adminRoleName, CodexDeployment codexDeployment)
|
||||||
|
{
|
||||||
|
Name = name;
|
||||||
|
Token = token;
|
||||||
|
ServerName = serverName;
|
||||||
|
AdminRoleName = adminRoleName;
|
||||||
|
CodexDeployment = codexDeployment;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Name { get; }
|
||||||
|
public string Token { get; }
|
||||||
|
public string ServerName { get; }
|
||||||
|
public string AdminRoleName { get; }
|
||||||
|
public CodexDeployment CodexDeployment { get; }
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue