remove leftover Resources Folder
This commit is contained in:
parent
2f5622e26c
commit
b92391efcd
|
@ -12,4 +12,9 @@
|
||||||
<ProjectReference Include="../../Lib/S3Utils/S3Utils.csproj" />
|
<ProjectReference Include="../../Lib/S3Utils/S3Utils.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="AWSSDK.S3" Version="3.7.203.12" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
<?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>
|
|
|
@ -1,4 +0,0 @@
|
||||||
{
|
|
||||||
"Key": "EXO1abcb772bf43ab72951ba1dc",
|
|
||||||
"Secret": "_ym1KsGBSp90S5dwhZn18XD-u9Y4ghHvyIxg5gv5fHw"
|
|
||||||
}
|
|
|
@ -1,5 +0,0 @@
|
||||||
{
|
|
||||||
"Key": "EXOb6d6dc1880cdd51f1ebc6692",
|
|
||||||
"Secret": "kpIey4QJlQFuWG_WoTazcY7kBEjN2f_ll2cDBeg64m4",
|
|
||||||
"Region": "sos-ch-dk-2.exo.io"
|
|
||||||
}
|
|
|
@ -1,5 +0,0 @@
|
||||||
{
|
|
||||||
"Key": "EXO87ca85e29dd412f1238f1cf0",
|
|
||||||
"Secret": "-T9TAqy9a3-0-xj7HKsFFJOCcxfRpcnL6OW5oOrOcWU",
|
|
||||||
"Region": "sos-ch-dk-2.exo.io"
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,6 +0,0 @@
|
||||||
{
|
|
||||||
"Url": "mail.agenturserver.de",
|
|
||||||
"Port": 587,
|
|
||||||
"Username": "p518526p69",
|
|
||||||
"Password": "i;b*xqm4iB5uhl"
|
|
||||||
}
|
|
|
@ -1,6 +0,0 @@
|
||||||
{
|
|
||||||
"ReadOnlyS3Key": "EXO44d2979c8e570eae81ead564",
|
|
||||||
"ReadOnlyS3Secret": "55MAqyO_FqUmh7O64VIO0egq50ERn_WIAWuc2QC44QU" ,
|
|
||||||
"ReadWriteS3Key": "EXO87ca85e29dd412f1238f1cf0",
|
|
||||||
"ReadWriteS3Secret": "-T9TAqy9a3-0-xj7HKsFFJOCcxfRpcnL6OW5oOrOcWU"
|
|
||||||
}
|
|
|
@ -0,0 +1,68 @@
|
||||||
|
using InnovEnergy.Lib.S3Utils.DataTypes;
|
||||||
|
using static System.Environment;
|
||||||
|
|
||||||
|
namespace InnovEnergy.Lib.S3Utils;
|
||||||
|
|
||||||
|
public static class S3Cfg
|
||||||
|
{
|
||||||
|
internal static readonly String S3CfgFile = GetFolderPath(SpecialFolder.UserProfile)
|
||||||
|
.TrimEnd('\\', '/') + "/.s3cfg";
|
||||||
|
|
||||||
|
internal static Dictionary<String, String> FromFile(String cfgFilePath)
|
||||||
|
{
|
||||||
|
return File
|
||||||
|
.ReadAllLines(cfgFilePath)
|
||||||
|
.Where(l => l.Contains("="))
|
||||||
|
.Select(l => l.Split("="))
|
||||||
|
.ToDictionary(l => l[0].Trim(), l => l[1].Trim());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static S3Credentials? GetDefaultUserCredentials() => GetCredentialsFromFile(S3CfgFile);
|
||||||
|
|
||||||
|
public static S3Credentials? GetCredentialsFromFile(String file)
|
||||||
|
{
|
||||||
|
// [default]
|
||||||
|
// host_base = sos-ch-dk-2.exo.io
|
||||||
|
// host_bucket = %(bucket)s.sos-ch-dk-2.exo.io
|
||||||
|
// access_key = xxxxxxxxxxxxxxx
|
||||||
|
// secret_key = xxxxxxxxxxxxxxx
|
||||||
|
// use_https = True
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var cfg = FromFile(file);
|
||||||
|
|
||||||
|
return new S3Credentials
|
||||||
|
(
|
||||||
|
Key : cfg["access_key"],
|
||||||
|
Secret: cfg["secret_key"]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static S3Region? GetDefaultRegionAndCredentials() => GetRegionAndCredentialsFromFile(S3CfgFile);
|
||||||
|
|
||||||
|
public static S3Region? GetRegionAndCredentialsFromFile(String file)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var cfg = FromFile(file);
|
||||||
|
|
||||||
|
var credentials = new S3Credentials
|
||||||
|
(
|
||||||
|
Key : cfg["access_key"],
|
||||||
|
Secret: cfg["secret_key"]
|
||||||
|
);
|
||||||
|
|
||||||
|
return new S3Region(Name: cfg["host_base"], Credentials: credentials);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue