@@ -98,6 +98,11 @@ pub struct Install {
98
98
#[ clap( long = PLUGIN_OVERRIDE_COMPATIBILITY_CHECK_FLAG , takes_value = false ) ]
99
99
pub override_compatibility_check : bool ,
100
100
101
+ /// Provide the value for the authorization header to be able to install a plugin from a private repository.
102
+ /// (e.g) --auth-header-value "Bearer <token>"
103
+ #[ clap( long = "auth-header-value" , requires = PLUGIN_REMOTE_PLUGIN_MANIFEST_OPT ) ]
104
+ pub auth_header_value : Option < String > ,
105
+
101
106
/// Specific version of a plugin to be install from the centralized plugins
102
107
/// repository.
103
108
#[ clap(
@@ -126,6 +131,7 @@ impl Install {
126
131
& manifest_location,
127
132
self . override_compatibility_check ,
128
133
SPIN_VERSION ,
134
+ & self . auth_header_value ,
129
135
)
130
136
. await ?;
131
137
try_install (
@@ -135,6 +141,7 @@ impl Install {
135
141
self . override_compatibility_check ,
136
142
downgrade,
137
143
& manifest_location,
144
+ & self . auth_header_value ,
138
145
)
139
146
. await ?;
140
147
Ok ( ( ) )
@@ -207,6 +214,11 @@ pub struct Upgrade {
207
214
#[ clap( short = 'y' , long = "yes" , takes_value = false ) ]
208
215
pub yes_to_all : bool ,
209
216
217
+ /// Provide the value for the authorization header to be able to install a plugin from a private repository.
218
+ /// (e.g) --auth-header-value "Bearer <token>"
219
+ #[ clap( long = "auth-header-value" , requires = PLUGIN_REMOTE_PLUGIN_MANIFEST_OPT ) ]
220
+ pub auth_header_value : Option < String > ,
221
+
210
222
/// Overrides a failed compatibility check of the plugin with the current version of Spin.
211
223
#[ clap( long = PLUGIN_OVERRIDE_COMPATIBILITY_CHECK_FLAG , takes_value = false ) ]
212
224
pub override_compatibility_check : bool ,
@@ -288,7 +300,12 @@ impl Upgrade {
288
300
289
301
// Attempt to get the manifest to check eligibility to upgrade
290
302
if let Ok ( manifest) = manager
291
- . get_manifest ( & manifest_location, false , SPIN_VERSION )
303
+ . get_manifest (
304
+ & manifest_location,
305
+ false ,
306
+ SPIN_VERSION ,
307
+ & self . auth_header_value ,
308
+ )
292
309
. await
293
310
{
294
311
// Check if upgraded candidates have a newer version and if are compatible
@@ -341,7 +358,16 @@ impl Upgrade {
341
358
None ,
342
359
) ) ;
343
360
344
- try_install ( & manifest, & manager, true , false , false , & manifest_location) . await ?;
361
+ try_install (
362
+ & manifest,
363
+ & manager,
364
+ true ,
365
+ false ,
366
+ false ,
367
+ & manifest_location,
368
+ & self . auth_header_value ,
369
+ )
370
+ . await ?;
345
371
}
346
372
347
373
Ok ( ( ) )
@@ -365,6 +391,7 @@ impl Upgrade {
365
391
& manifest_location,
366
392
self . override_compatibility_check ,
367
393
SPIN_VERSION ,
394
+ & self . auth_header_value ,
368
395
)
369
396
. await
370
397
{
@@ -382,6 +409,7 @@ impl Upgrade {
382
409
self . override_compatibility_check ,
383
410
self . downgrade ,
384
411
& manifest_location,
412
+ & self . auth_header_value ,
385
413
)
386
414
. await ?;
387
415
}
@@ -405,6 +433,7 @@ impl Upgrade {
405
433
& manifest_location,
406
434
self . override_compatibility_check ,
407
435
SPIN_VERSION ,
436
+ & self . auth_header_value ,
408
437
)
409
438
. await ?;
410
439
try_install (
@@ -414,6 +443,7 @@ impl Upgrade {
414
443
self . override_compatibility_check ,
415
444
self . downgrade ,
416
445
& manifest_location,
446
+ & self . auth_header_value ,
417
447
)
418
448
. await ?;
419
449
Ok ( ( ) )
@@ -434,6 +464,7 @@ impl Show {
434
464
& ManifestLocation :: PluginsRepository ( PluginLookup :: new ( & self . name , None ) ) ,
435
465
false ,
436
466
SPIN_VERSION ,
467
+ & None ,
437
468
)
438
469
. await ?;
439
470
@@ -789,6 +820,7 @@ async fn try_install(
789
820
override_compatibility_check : bool ,
790
821
downgrade : bool ,
791
822
source : & ManifestLocation ,
823
+ auth_header_value : & Option < String > ,
792
824
) -> Result < bool > {
793
825
let install_action = manager. check_manifest (
794
826
manifest,
@@ -804,7 +836,9 @@ async fn try_install(
804
836
805
837
let package = manager:: get_package ( manifest) ?;
806
838
if continue_to_install ( manifest, package, yes_to_all) ? {
807
- let installed = manager. install ( manifest, package, source) . await ?;
839
+ let installed = manager
840
+ . install ( manifest, package, source, auth_header_value)
841
+ . await ?;
808
842
println ! ( "Plugin '{installed}' was installed successfully!" ) ;
809
843
810
844
if let Some ( description) = manifest. description ( ) {
0 commit comments