added one method to fetch docker credentials
This commit is contained in:
parent
6f49278e75
commit
c3c9b4bc75
7
flist.v
7
flist.v
@ -138,6 +138,13 @@ fn get_docker_credential() !string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn get_docker_credential_auto() !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
|
// Read the Docker config file
|
||||||
config_path := os.join_path(os.home_dir(), '.docker', 'config.json')
|
config_path := os.join_path(os.home_dir(), '.docker', 'config.json')
|
||||||
config_content := os.read_file(config_path) or {
|
config_content := os.read_file(config_path) or {
|
||||||
|
Loading…
Reference in New Issue
Block a user