File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -165,6 +165,20 @@ pub enum Commands {
165165 #[ arg( short, long) ]
166166 skip_failed : bool ,
167167 } ,
168+
169+ /// Set the allowed CORS origins for a tenant
170+ /// (Overrides existing CORS configuration)
171+ SetAllowedStorageCorsOrigins {
172+ // Environment to target
173+ #[ arg( short, long) ]
174+ env : String ,
175+ /// ID of the tenant to target
176+ #[ arg( short, long) ]
177+ tenant_id : TenantId ,
178+ /// Allowed origins to set
179+ #[ arg( short, long) ]
180+ origin : Vec < String > ,
181+ } ,
168182}
169183
170184#[ tokio:: main]
@@ -647,5 +661,36 @@ async fn app(args: Args) -> eyre::Result<()> {
647661
648662 Ok ( ( ) )
649663 }
664+
665+ Commands :: SetAllowedStorageCorsOrigins {
666+ env,
667+ tenant_id,
668+ origin,
669+ } => {
670+ let tenant =
671+ docbox_management:: tenant:: get_tenant:: get_tenant ( & db_provider, & env, tenant_id)
672+ . await ?
673+ . context ( "tenant not found" ) ?;
674+
675+ let storage = storage_factory. create_storage_layer ( & tenant) ;
676+
677+ storage. set_bucket_cors_origins ( origin) . await ?;
678+
679+ match args. format {
680+ OutputFormat :: Human => {
681+ println ! ( "updated tenant allowed origins" )
682+ }
683+ OutputFormat :: Json => {
684+ println ! (
685+ "{}" ,
686+ serde_json:: to_string_pretty( & json!( {
687+ "success" : true
688+ } ) ) ?
689+ ) ;
690+ }
691+ }
692+
693+ Ok ( ( ) )
694+ }
650695 }
651696}
You can’t perform that action at this time.
0 commit comments