using Docker.DotNet; using Microsoft.Extensions.Options; using MoonlightServers.Daemon.Configuration; using MoonlightServers.Daemon.ServerSystem.Abstractions; namespace MoonlightServers.Daemon.ServerSystem.Implementations.Docker; public static class Extensions { public static void AddDockerServices(this IServiceCollection collection) { collection.AddOptions().BindConfiguration("Moonlight:Docker"); collection.AddSingleton(sp => { var options = sp.GetRequiredService>(); return new DockerClientBuilder() .WithEndpoint(new Uri(options.Value.SocketUri)) .Build(); }); collection.AddSingleton(); collection.AddHostedService(sp => sp.GetRequiredService()); collection.AddSingleton(); collection.AddSingleton(); collection.AddSingleton(); } }