25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/ufo/ecr/auth.rb', line 25
def update
return unless ecr_image?
auth_token = fetch_auth_token
if File.exist?(docker_config)
data = JSON.load(IO.read(docker_config))
data["auths"][@repo_domain] = {auth: auth_token}
else
data = {"auths" => {@repo_domain => {auth: auth_token}}}
end
legacy_entry = "https://#{@repo_domain}"
data["auths"][legacy_entry] = {auth: auth_token}
ensure_dotdocker_exists
IO.write(docker_config, JSON.pretty_generate(data))
end
|