From c3c9b4bc75c95ab612cb3128f49eca7c41fb1056 Mon Sep 17 00:00:00 2001 From: mik-tf Date: Thu, 3 Oct 2024 11:25:09 -0400 Subject: [PATCH] added one method to fetch docker credentials --- flist.v | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/flist.v b/flist.v index 865251d..d8be717 100644 --- a/flist.v +++ b/flist.v @@ -138,6 +138,13 @@ fn get_docker_credential() !string { } fn get_docker_credential_auto() !string { + // First, try to get the Docker username using the system info command + system_info_result := os.execute('sudo docker system info | grep \'Username\' | cut -d \' \' -f 3') + if system_info_result.exit_code == 0 && system_info_result.output.trim_space() != '' { + return system_info_result.output.trim_space() + } + + // If the above method fails, proceed with the current method // Read the Docker config file config_path := os.join_path(os.home_dir(), '.docker', 'config.json') config_content := os.read_file(config_path) or {