File tree Expand file tree Collapse file tree 5 files changed +18
-3
lines changed Expand file tree Collapse file tree 5 files changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ public sealed class DockerService : IDockerService
1111{
1212 private readonly DockerClient _client ;
1313 private readonly ILogger < DockerService > _logger ;
14+ private readonly ApplicationSettings _options ;
1415
1516 public DockerService (
1617 IOptions < ApplicationSettings > options ,
@@ -20,6 +21,7 @@ public DockerService(
2021 _client = new DockerClientConfiguration (
2122 new Uri ( options . Value . DockerHost ) )
2223 . CreateClient ( ) ;
24+ _options = options . Value ;
2325 }
2426
2527 public async Task < IList < ContainerListResponse > ? > GetAllContainersAsync ( CancellationToken cancellationToken )
@@ -190,7 +192,12 @@ await _client.Images.CreateImageAsync(
190192 FromImage = image ,
191193 Tag = tag
192194 } ,
193- new AuthConfig ( ) ,
195+ new AuthConfig
196+ {
197+ ServerAddress = _options . DockerRegistryUrl ,
198+ Username = _options . DockerRegistryUsername ,
199+ Password = _options . DockerRegistryPassword
200+ } ,
194201 new Progress < JSONMessage > ( ) ,
195202 cancellationToken ) ;
196203 return true ;
Original file line number Diff line number Diff line change @@ -6,4 +6,7 @@ public sealed class ApplicationSettings
66 public required string DockerHost { get ; init ; }
77 public string AdminUser { get ; init ; } = string . Empty ;
88 public required string CommandPrefix { get ; init ; }
9+ public string DockerRegistryUrl { get ; init ; } = string . Empty ;
10+ public string DockerRegistryUsername { get ; init ; } = string . Empty ;
11+ public string DockerRegistryPassword { get ; init ; } = string . Empty ;
912}
Original file line number Diff line number Diff line change 1717 "DiscordToken" : " " ,
1818 "DockerHost" : " unix:///var/run/docker.sock" ,
1919 "AdminUser" : " " ,
20- "CommandPrefix" : " !"
20+ "CommandPrefix" : " !" ,
21+ "DockerRegistryUrl" : " " ,
22+ "DockerRegistryUsername" : " " ,
23+ "DockerRegistryPassword" : " "
2124 }
2225}
Original file line number Diff line number Diff line change @@ -80,6 +80,9 @@ The bot can be configured using environment variables:
8080| ` ApplicationSettings__DiscordToken` | Discord bot token | `null` | ✅ |
8181| `ApplicationSettings__AdminUser` | Discord admin username | `null` | ❌ |
8282| `ApplicationSettings__CommandPrefix` | Command prefix | `!` | ❌ |
83+ | `ApplicationSettings__DockerRegistryUrl` | Private registry url | `null` | ❌ |
84+ | `ApplicationSettings__DockerRegistryUsername` | Private registry username | `null` | ❌ |
85+ | `ApplicationSettings__DockerRegistryPassword` | Private registry password | `null` | ❌ |
8386
8487# # License
8588
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments