Set bucket cors on creation of new installation

This commit is contained in:
Kim 2023-07-13 10:01:30 +02:00
parent be18b291af
commit a070891e7e
2 changed files with 12 additions and 1 deletions

View File

@ -46,8 +46,19 @@ public class S3Cmd
public async Task<Boolean> CreateBucket(String bucketName)
{
var cors = @"<?xml version=""1.0"" ?>
<CORSConfiguration xmlns=""http://s3.amazonaws.com/doc/2006-03-01/"">
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<AllowedMethod>HEAD</AllowedMethod>
<AllowedHeader>*</AllowedHeader>
</CORSRule>
</CORSConfiguration>";
var result = await Run(bucketName, "mb");
return result.ExitCode == 0;
var setCors = await Run(bucketName, "PutBucketCors", cors);
return result.ExitCode == 0 && setCors.ExitCode == 0;
}
public async Task<Boolean> DeleteBucket(String bucketName)

Binary file not shown.