@@ -3,12 +3,10 @@ use anyhow::Result;
33use futures:: { stream:: FuturesUnordered , StreamExt } ;
44use indexmap:: IndexMap ;
55use miette:: SourceSpan ;
6- use secrecy:: Secret ;
76use semver:: { Version , VersionReq } ;
87use std:: { fs, path:: Path , sync:: Arc } ;
98use wac_types:: BorrowedPackageKey ;
10- use warg_client:: { Client , ClientError , Config , FileSystemClient , RegistryUrl } ;
11- use warg_credentials:: keyring:: get_auth_token;
9+ use warg_client:: { Client , ClientError , Config , FileSystemClient } ;
1210use warg_protocol:: registry:: PackageName ;
1311
1412/// Implemented by progress bars.
@@ -43,13 +41,8 @@ impl RegistryPackageResolver {
4341 ///
4442 /// If `url` is `None`, the default URL will be used.
4543 pub fn new ( url : Option < & str > , bar : Option < Box < dyn ProgressBar > > ) -> Result < Self > {
46- let config = Config :: from_default_file ( ) ?. unwrap_or_default ( ) ;
4744 Ok ( Self {
48- client : Arc :: new ( Client :: new_with_config (
49- url,
50- & config,
51- Self :: auth_token ( & config, url) ?,
52- ) ?) ,
45+ client : Arc :: new ( Client :: new_with_default_config ( url) ?) ,
5346 bar,
5447 } )
5548 }
@@ -63,11 +56,7 @@ impl RegistryPackageResolver {
6356 bar : Option < Box < dyn ProgressBar > > ,
6457 ) -> Result < Self > {
6558 Ok ( Self {
66- client : Arc :: new ( Client :: new_with_config (
67- url,
68- config,
69- Self :: auth_token ( config, url) ?,
70- ) ?) ,
59+ client : Arc :: new ( Client :: new_with_config ( url, config, None ) ?) ,
7160 bar,
7261 } )
7362 }
@@ -201,18 +190,4 @@ impl RegistryPackageResolver {
201190 source : e. into ( ) ,
202191 } )
203192 }
204-
205- pub fn auth_token ( config : & Config , url : Option < & str > ) -> Result < Option < Secret < String > > > {
206- if config. keyring_auth {
207- return if let Some ( url) = url {
208- Ok ( get_auth_token ( & RegistryUrl :: new ( url) ?) ?)
209- } else if let Some ( url) = config. home_url . as_ref ( ) {
210- Ok ( get_auth_token ( & RegistryUrl :: new ( url) ?) ?)
211- } else {
212- Ok ( None )
213- } ;
214- }
215-
216- Ok ( None )
217- }
218193}
0 commit comments