Implemented statistics. Refactored storage abstractions. Added config options for docker and local storage. Added server service and server updating.
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
using Docker.DotNet;
|
||||
using Microsoft.Extensions.Options;
|
||||
using MoonlightServers.Daemon.Configuration;
|
||||
using MoonlightServers.Daemon.ServerSystem.Abstractions;
|
||||
|
||||
namespace MoonlightServers.Daemon.ServerSystem.Implementations.Docker;
|
||||
@@ -7,16 +9,23 @@ public static class Extensions
|
||||
{
|
||||
public static void AddDockerServices(this IServiceCollection collection)
|
||||
{
|
||||
var client = new DockerClientBuilder()
|
||||
.WithEndpoint(new Uri("unix:///var/run/docker.sock"))
|
||||
.Build();
|
||||
collection.AddOptions<DockerOptions>().BindConfiguration("Moonlight:Docker");
|
||||
|
||||
collection.AddSingleton(client);
|
||||
collection.AddSingleton(sp =>
|
||||
{
|
||||
var options = sp.GetRequiredService<IOptions<DockerOptions>>();
|
||||
|
||||
return new DockerClientBuilder()
|
||||
.WithEndpoint(new Uri(options.Value.SocketUri))
|
||||
.Build();
|
||||
});
|
||||
|
||||
collection.AddSingleton<DockerEventService>();
|
||||
collection.AddHostedService(sp => sp.GetRequiredService<DockerEventService>());
|
||||
|
||||
collection.AddSingleton<IRuntimeEnvironmentService, DockerRuntimeEnvService>();
|
||||
collection.AddSingleton<IInstallEnvironmentService, DockerInstallEnvService>();
|
||||
|
||||
collection.AddSingleton<ContainerConfigMapper>();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user