getDockerConfigJson(): Return empty auth when ~/.docker/config.json doesn't exist

This commit is contained in:
Daniel Rudolf 2023-12-17 00:22:26 +01:00
parent a7d8d3e644
commit 8828a2343e
No known key found for this signature in database
GPG key ID: A061F02CD8DE4538

View file

@ -69,5 +69,6 @@ export async function execute(
export async function getDockerConfigJson(): Promise<string> { export async function getDockerConfigJson(): Promise<string> {
const dockerConfigPath = path.join(os.homedir(), ".docker", "config.json"); const dockerConfigPath = path.join(os.homedir(), ".docker", "config.json");
return fs.readFile(dockerConfigPath, "utf-8"); return fs.readFile(dockerConfigPath, "utf-8")
.catch((err) => { if (err.code === 'ENOENT') { return '{"auths":{}}'; } throw err; });
} }