Skip to content

Commit

Permalink
add debug logs for getAuthForDockerImage
Browse files Browse the repository at this point in the history
  • Loading branch information
s4ke committed Oct 15, 2024
1 parent 5815132 commit 320df38
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions swarmgate/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ try {
console.error(`Failed to load registry auth overrides: ${error.message}`);
}

function getRegistryFromDockerImage(image: string): string {
function getRegistryFromDockerImage(image) {
const parts = image.split('/');
if (parts.length < 2) {
return '';
Expand All @@ -67,11 +67,20 @@ function getAuthForDockerImage(image: string): {
registry: string
} {
let registry = getRegistryFromDockerImage(image);
console.log(`detected registry: ${registry} for image ${image}`);
if (!registry) {
registry = 'docker.io';
}
const auth = getAuthForRegistry(registry);
console.log(`auth for registry ${registry}: ${JSON.stringify({
anonymous: auth?.anonymous,
username: auth?.username,
email: auth?.email,
password: "***",
serveraddress: auth?.serveraddress
})}`);
return {
auth: getAuthForRegistry(registry),
auth: auth,
registry: registry
};
}
Expand Down

0 comments on commit 320df38

Please sign in to comment.