This commit is contained in:
Sina Blattmann 2023-07-06 11:02:47 +02:00
commit 16597f950b
7 changed files with 22 additions and 6 deletions

View File

@ -14,6 +14,7 @@
<PackageReference Include="Microsoft.AspNet.Identity.Owin" Version="2.2.3" />
<PackageReference Include="Microsoft.AspNet.WebApi.Core" Version="5.2.9" />
<PackageReference Include="Microsoft.AspNetCore.Identity" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.2.5" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
<PackageReference Include="Microsoft.Identity.Web" Version="1.26.0" />
<PackageReference Include="Microsoft.Owin.Cors" Version="4.2.2" />

View File

@ -15,7 +15,6 @@ public class Installation : TreeNode
public Double Lat { get; set; }
public Double Long { get; set; }
public String S3Bucket { get; set; } = "";
public String S3Region { get; set; } = "";
public String S3Provider { get; set; } = "";
public String S3Key { get; set; } = "";

View File

@ -13,6 +13,8 @@ public static class ExoCmd
{
//if (installation.Id != 1) return "help"; //Todo remove me I am for debugging
var preParse = await Exo
.WithArguments("iam access-key create " + installation.BucketName()
+ " --operation get-sos-object"

View File

@ -1,5 +1,7 @@
using System.Reactive.Concurrency;
using System.Reactive.Linq;
using CliWrap;
using CliWrap.Buffered;
using InnovEnergy.App.Backend.DataTypes;
using InnovEnergy.App.Backend.DataTypes.Methods;
using InnovEnergy.App.Backend.Relations;
@ -96,11 +98,22 @@ public static partial class Db
Sessions.Delete(s => s.LastSeen < deadline);
}
private static Task UpdateS3Urls()
private static async Task UpdateS3Urls()
{
return Installations
.Select(i => i.RenewS3BucketUrl())
.WhenAll();
var bucketList = await Cli.Wrap("exo")
.WithArguments("storage list -O json")
.ExecuteBufferedAsync();
var installationsToUpdate = Installations
.Select(i => i)
.Where(i => bucketList.StandardOutput.Contains("\"" + i.BucketName())).ToList()
;
foreach (var installation in installationsToUpdate)
{
await installation.RenewS3BucketUrl();
}
}
}

View File

@ -1,5 +1,6 @@
{
"$schema": "https://json.schemastore.org/launchsettings.json",
"$SdkResolverGlobalJsonPath": "",
"profiles": {
"Backend": {
"commandName": "Project",

Binary file not shown.

Binary file not shown.