Files
Servers/MoonlightServers.Daemon/Services/ServerConfigurationService.cs

50 lines
1.6 KiB
C#

using MoonlightServers.Daemon.Models;
namespace MoonlightServers.Daemon.Services;
public class ServerConfigurationService
{
public async Task<RuntimeConfiguration> GetRuntimeConfigurationAsync(string uuid)
{
return new RuntimeConfiguration(
new RuntimeLimitsConfig(400, null, 4096, null),
new RuntimeStorageConfig("local", [], 10240),
new RuntimeTemplateConfig(
"ghcr.io/pterodactyl/yolks:java_21",
"java -jar -Xmx{{SERVER_MEMORY}}M server.jar",
"stop",
["Done"]
),
new RuntimeNetworkConfig(
[],
null,
null,
new RuntimePortConfig("0.0.0.0", 25565),
[
new RuntimePortConfig("0.0.0.0", 25565)
]
),
new RuntimeEnvironmentConfig(
new Dictionary<string, string>()
{
{ "testy", "ytset" }
},
new Dictionary<string, string>()
{
{ "SERVER_MEMORY", "4096" },
{"MINECRAFT_VERSION", "latest"},
{"SERVER_JARFILE", "server.jar"}
}
)
);
}
public async Task<InstallConfiguration> GetInstallConfigurationAsync(string uuid)
{
return new InstallConfiguration(
"bash",
"installer",
await File.ReadAllTextAsync("/home/chiara/Documents/daemonScripts/install.sh")
);
}
}