development_dockername #5
7
flist.v
7
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 {
|
||||
|
Loading…
Reference in New Issue
Block a user