Module: Docker::Template::Auth
- Defined in:
- lib/docker/template/auth.rb
Class Method Summary collapse
Class Method Details
.auth! ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/docker/template/auth.rb', line 6 def auth! return unless login = credentials login["auths"].each do |server, auth| username, password = Base64.decode64(auth["auth"]).split(":", 2) Docker.authenticate!({ "username" => username, "serveraddress" => server, "email" => auth["email"], "password" => password }) end end |
.credentials ⇒ Object
19 20 21 22 |
# File 'lib/docker/template/auth.rb', line 19 def credentials path = Pathname.new("~/.docker/config.json"). JSON.parse(path.read) if path.exist? end |