Class: Tagfish::DockerHttpAuth
- Inherits:
-
Object
- Object
- Tagfish::DockerHttpAuth
- Defined in:
- lib/tagfish/docker_http_auth.rb
Instance Attribute Summary collapse
-
#password ⇒ Object
Returns the value of attribute password.
-
#username ⇒ Object
Returns the value of attribute username.
Instance Method Summary collapse
-
#initialize(registry) ⇒ DockerHttpAuth
constructor
A new instance of DockerHttpAuth.
Constructor Details
#initialize(registry) ⇒ DockerHttpAuth
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/tagfish/docker_http_auth.rb', line 10 def initialize(registry) file_path = '~/.docker/config.json' begin config = File.open(File.(file_path), 'r') rescue Exception => e abort("Tried to get a SLiP but the file #{file_path} does not exist") end json_config = JSON.parse(config.read()) config.close() if json_config['auths'].length == 0 @username, @password = nil, nil else b64_auth = json_config['auths'][registry]['auth'] auth = Base64.decode64(b64_auth) @username, @password = auth.split(':') end end |
Instance Attribute Details
#password ⇒ Object
Returns the value of attribute password.
8 9 10 |
# File 'lib/tagfish/docker_http_auth.rb', line 8 def password @password end |
#username ⇒ Object
Returns the value of attribute username.
7 8 9 |
# File 'lib/tagfish/docker_http_auth.rb', line 7 def username @username end |