From 6296df7c0ccd0909d1150aa76e70d8cc3fa88d50 Mon Sep 17 00:00:00 2001 From: Nikolay Edigaryev Date: Tue, 30 Aug 2022 00:38:51 +0400 Subject: [PATCH] Credential helpers: "credHelpers" map is optional in Docker's config (#209) --- .../tart/Credentials/HelperProgramCredentialsProvider.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Sources/tart/Credentials/HelperProgramCredentialsProvider.swift b/Sources/tart/Credentials/HelperProgramCredentialsProvider.swift index 05feade9..1a58b461 100644 --- a/Sources/tart/Credentials/HelperProgramCredentialsProvider.swift +++ b/Sources/tart/Credentials/HelperProgramCredentialsProvider.swift @@ -7,8 +7,8 @@ class HelperProgramCredentialsProvider: CredentialsProvider { return nil } let config = try JSONDecoder().decode(DockerConfig.self, from: Data(contentsOf: dockerConfigURL)) - - if let helperProgram = config.credHelpers[host] { + + if let helperProgram = config.credHelpers?[host] { return try executeHelper(binaryName: "docker-credential-\(helperProgram)", host: host) } @@ -54,7 +54,7 @@ class HelperProgramCredentialsProvider: CredentialsProvider { } struct DockerConfig: Codable { - var credHelpers: Dictionary = Dictionary() + var credHelpers: Dictionary? = Dictionary() } struct DockerGetOutput: Codable {