@@ -43,7 +43,7 @@ def get_config_header(client, registry):
43
43
log .debug (
44
44
"No auth config in memory - loading from filesystem"
45
45
)
46
- client ._auth_configs = load_config ()
46
+ client ._auth_configs = load_config (credstore_env = client . credstore_env )
47
47
authcfg = resolve_authconfig (
48
48
client ._auth_configs , registry , credstore_env = client .credstore_env
49
49
)
@@ -70,14 +70,16 @@ def split_repo_name(repo_name):
70
70
71
71
72
72
def get_credential_store (authconfig , registry ):
73
+ if not isinstance (authconfig , AuthConfig ):
74
+ authconfig = AuthConfig (authconfig )
73
75
return authconfig .get_credential_store (registry )
74
76
75
77
76
- class AuthConfig (object ):
78
+ class AuthConfig (dict ):
77
79
def __init__ (self , dct , credstore_env = None ):
78
80
if 'auths' not in dct :
79
81
dct ['auths' ] = {}
80
- self ._dct = dct
82
+ self .update ( dct )
81
83
self ._credstore_env = credstore_env
82
84
self ._stores = {}
83
85
@@ -200,15 +202,15 @@ def load_config(cls, config_path, config_dict, credstore_env=None):
200
202
201
203
@property
202
204
def auths (self ):
203
- return self ._dct . get ('auths' , {})
205
+ return self .get ('auths' , {})
204
206
205
207
@property
206
208
def creds_store (self ):
207
- return self ._dct . get ('credsStore' , None )
209
+ return self .get ('credsStore' , None )
208
210
209
211
@property
210
212
def cred_helpers (self ):
211
- return self ._dct . get ('credHelpers' , {})
213
+ return self .get ('credHelpers' , {})
212
214
213
215
def resolve_authconfig (self , registry = None ):
214
216
"""
@@ -305,10 +307,12 @@ def get_all_credentials(self):
305
307
return auth_data
306
308
307
309
def add_auth (self , reg , data ):
308
- self . _dct ['auths' ][reg ] = data
310
+ self ['auths' ][reg ] = data
309
311
310
312
311
313
def resolve_authconfig (authconfig , registry = None , credstore_env = None ):
314
+ if not isinstance (authconfig , AuthConfig ):
315
+ authconfig = AuthConfig (authconfig , credstore_env )
312
316
return authconfig .resolve_authconfig (registry )
313
317
314
318
0 commit comments