@@ -98,6 +98,10 @@ pub struct Install {
9898 #[ clap( long = PLUGIN_OVERRIDE_COMPATIBILITY_CHECK_FLAG , takes_value = false ) ]
9999 pub override_compatibility_check : bool ,
100100
101+ /// Provide the auth header value to be able to install a plugin from a private repository.
102+ #[ clap( long = "auth-header-value" , requires = PLUGIN_REMOTE_PLUGIN_MANIFEST_OPT ) ]
103+ pub auth_header_value : Option < String > ,
104+
101105 /// Specific version of a plugin to be install from the centralized plugins
102106 /// repository.
103107 #[ clap(
@@ -126,6 +130,7 @@ impl Install {
126130 & manifest_location,
127131 self . override_compatibility_check ,
128132 SPIN_VERSION ,
133+ self . auth_header_value . clone ( ) ,
129134 )
130135 . await ?;
131136 try_install (
@@ -135,6 +140,7 @@ impl Install {
135140 self . override_compatibility_check ,
136141 downgrade,
137142 & manifest_location,
143+ self . auth_header_value . clone ( ) ,
138144 )
139145 . await ?;
140146 Ok ( ( ) )
@@ -207,6 +213,10 @@ pub struct Upgrade {
207213 #[ clap( short = 'y' , long = "yes" , takes_value = false ) ]
208214 pub yes_to_all : bool ,
209215
216+ /// Auth header value to be able to install a plugin from a private repository.
217+ #[ clap( long = "auth-header-value" , requires = PLUGIN_REMOTE_PLUGIN_MANIFEST_OPT ) ]
218+ pub auth_header_value : Option < String > ,
219+
210220 /// Overrides a failed compatibility check of the plugin with the current version of Spin.
211221 #[ clap( long = PLUGIN_OVERRIDE_COMPATIBILITY_CHECK_FLAG , takes_value = false ) ]
212222 pub override_compatibility_check : bool ,
@@ -288,7 +298,12 @@ impl Upgrade {
288298
289299 // Attempt to get the manifest to check eligibility to upgrade
290300 if let Ok ( manifest) = manager
291- . get_manifest ( & manifest_location, false , SPIN_VERSION )
301+ . get_manifest (
302+ & manifest_location,
303+ false ,
304+ SPIN_VERSION ,
305+ self . auth_header_value . clone ( ) ,
306+ )
292307 . await
293308 {
294309 // Check if upgraded candidates have a newer version and if are compatible
@@ -341,7 +356,16 @@ impl Upgrade {
341356 None ,
342357 ) ) ;
343358
344- try_install ( & manifest, & manager, true , false , false , & manifest_location) . await ?;
359+ try_install (
360+ & manifest,
361+ & manager,
362+ true ,
363+ false ,
364+ false ,
365+ & manifest_location,
366+ self . auth_header_value . clone ( ) ,
367+ )
368+ . await ?;
345369 }
346370
347371 Ok ( ( ) )
@@ -365,6 +389,7 @@ impl Upgrade {
365389 & manifest_location,
366390 self . override_compatibility_check ,
367391 SPIN_VERSION ,
392+ self . auth_header_value . clone ( ) ,
368393 )
369394 . await
370395 {
@@ -382,6 +407,7 @@ impl Upgrade {
382407 self . override_compatibility_check ,
383408 self . downgrade ,
384409 & manifest_location,
410+ self . auth_header_value . clone ( ) ,
385411 )
386412 . await ?;
387413 }
@@ -405,6 +431,7 @@ impl Upgrade {
405431 & manifest_location,
406432 self . override_compatibility_check ,
407433 SPIN_VERSION ,
434+ self . auth_header_value . clone ( ) ,
408435 )
409436 . await ?;
410437 try_install (
@@ -414,6 +441,7 @@ impl Upgrade {
414441 self . override_compatibility_check ,
415442 self . downgrade ,
416443 & manifest_location,
444+ self . auth_header_value ,
417445 )
418446 . await ?;
419447 Ok ( ( ) )
@@ -434,6 +462,7 @@ impl Show {
434462 & ManifestLocation :: PluginsRepository ( PluginLookup :: new ( & self . name , None ) ) ,
435463 false ,
436464 SPIN_VERSION ,
465+ None ,
437466 )
438467 . await ?;
439468
@@ -789,6 +818,7 @@ async fn try_install(
789818 override_compatibility_check : bool ,
790819 downgrade : bool ,
791820 source : & ManifestLocation ,
821+ auth_header_value : Option < String > ,
792822) -> Result < bool > {
793823 let install_action = manager. check_manifest (
794824 manifest,
@@ -804,7 +834,9 @@ async fn try_install(
804834
805835 let package = manager:: get_package ( manifest) ?;
806836 if continue_to_install ( manifest, package, yes_to_all) ? {
807- let installed = manager. install ( manifest, package, source) . await ?;
837+ let installed = manager
838+ . install ( manifest, package, source, auth_header_value)
839+ . await ?;
808840 println ! ( "Plugin '{installed}' was installed successfully!" ) ;
809841
810842 if let Some ( description) = manifest. description ( ) {
0 commit comments