This commit is contained in:
@@ -129,6 +129,16 @@ namespace rockfishCore.Controllers
|
||||
//devops: https://test.helloayanova.com/api/v8/
|
||||
//Spaces and backup: https://gztw1.nyc3.digitaloceanspaces.com/
|
||||
//Need S3 library for c#
|
||||
/*
|
||||
IAmazonS3 amazonS3Client =
|
||||
AWSClientFactory.CreateAmazonS3Client("your-spaces-key", "your-spaces-key-secrete",
|
||||
new AmazonS3Config
|
||||
{
|
||||
ServiceURL = "https://nyc3.digitaloceanspaces.com"
|
||||
}
|
||||
);
|
||||
var myBuckets = amazonS3Client.ListBuckets();
|
||||
*/
|
||||
|
||||
|
||||
return Ret;
|
||||
|
||||
@@ -110,7 +110,7 @@ namespace rockfishCore
|
||||
//bool bMM=RfMail.MailIsMirroringProperly();
|
||||
try
|
||||
{
|
||||
var test = OpsDiagnostics.CheckWebsite("https://test.helloayanova.com/api/v8/", "AyaNova server");
|
||||
var test = OpsDiagnostics.CheckSpacesBackupStorage();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AWSSDK.Core" Version="3.3.24.4" />
|
||||
<PackageReference Include="AWSSDK.S3" Version="3.3.20" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.1.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.0" />
|
||||
|
||||
@@ -5,6 +5,8 @@ using System.Linq;
|
||||
using System.IO;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using Amazon.S3;
|
||||
using Amazon.S3.Transfer;
|
||||
|
||||
namespace rockfishCore.Util
|
||||
{
|
||||
@@ -20,15 +22,40 @@ namespace rockfishCore.Util
|
||||
if (Response.IsSuccessStatusCode)
|
||||
{
|
||||
var PageText = Response.Content.ReadAsStringAsync().Result;
|
||||
if(PageText.Contains(mustContain))
|
||||
if (PageText.Contains(mustContain))
|
||||
{
|
||||
Result=true;
|
||||
Result = true;
|
||||
}
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
|
||||
|
||||
public static bool CheckSpacesBackupStorage()
|
||||
{
|
||||
|
||||
var SECRET_KEY = "iNwbHr+sK+9is2wmRjIax+rdyEjLNvWKJBYr7w4txkY";
|
||||
var ACCESS_KEY = "CMPAFDNX53OWPC55HBJ4";
|
||||
var HOST_ENDPOINT = "https://nyc3.digitaloceanspaces.com";
|
||||
var BUCKET = "%(bucket)s.nyc3.digitaloceanspaces.com";
|
||||
AmazonS3Config clientConfig=new AmazonS3Config();
|
||||
clientConfig.ServiceURL=HOST_ENDPOINT;
|
||||
IAmazonS3 s3Client = new AmazonS3Client(ACCESS_KEY, SECRET_KEY, clientConfig);
|
||||
var bucketlist=s3Client.ListBucketsAsync().Result;
|
||||
|
||||
// IAmazonS3 amazonS3Client = new
|
||||
// AWSClientFactory.CreateAmazonS3Client("your-spaces-key", "your-spaces-key-secrete",
|
||||
// new AmazonS3Config
|
||||
// {
|
||||
// ServiceURL = "https://nyc3.digitaloceanspaces.com"
|
||||
// }
|
||||
// );
|
||||
// var myBuckets = amazonS3Client.ListBuckets();
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user