Set bucket cors on creation of new installation
This commit is contained in:
parent
be18b291af
commit
a070891e7e
|
@ -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.
Loading…
Reference in New Issue