3 Commits

Author SHA1 Message Date
2384117c79 test 2025-06-19 13:00:23 -06:00
daa9699bdd Implement Azurite 2025-06-09 00:40:43 -06:00
169c6409dc Implement hasgi corp vault 2025-06-01 22:53:59 -06:00
8 changed files with 39 additions and 21 deletions

View File

@@ -11,6 +11,7 @@ namespace Core.Blueprint.DAL.API.Controllers
[Produces("application/json")] [Produces("application/json")]
[ApiController] [ApiController]
[AllowAnonymous] [AllowAnonymous]
//test gitea
public class BlobStorageController(IBlobStorageService storageService) : ControllerBase public class BlobStorageController(IBlobStorageService storageService) : ControllerBase
{ {
[HttpPost("UploadBlobFromFileBrowser")] [HttpPost("UploadBlobFromFileBrowser")]

View File

@@ -13,21 +13,21 @@ using System.Text.Json.Serialization;
var builder = WebApplication.CreateBuilder(args); var builder = WebApplication.CreateBuilder(args);
builder.Configuration.AddAzureAppConfiguration(options => //builder.Configuration.AddAzureAppConfiguration(options =>
{ //{
var endpoint = builder.Configuration.GetSection("Endpoints:AppConfigurationURI").Value; // var endpoint = builder.Configuration.GetSection("Endpoints:AppConfigurationURI").Value;
if (string.IsNullOrEmpty(endpoint)) // if (string.IsNullOrEmpty(endpoint))
throw new ArgumentException("The app configuration is missing"); // throw new ArgumentException("The app configuration is missing");
options.Connect(new Uri(endpoint), new DefaultAzureCredential()) // options.Connect(new Uri(endpoint), new DefaultAzureCredential())
.Select(KeyFilter.Any, "blueprint_dal"); // .Select(KeyFilter.Any, "blueprint_dal");
options.ConfigureKeyVault(keyVaultOptions => // options.ConfigureKeyVault(keyVaultOptions =>
{ // {
keyVaultOptions.SetCredential(new DefaultAzureCredential()); // keyVaultOptions.SetCredential(new DefaultAzureCredential());
}); // });
}); //});
builder.Services.AddEndpointsApiExplorer(); builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen(); builder.Services.AddSwaggerGen();
@@ -41,9 +41,9 @@ builder.Services.AddMemoryCache();
builder.Services.AddLogs(builder); builder.Services.AddLogs(builder);
builder.Services.AddKeyVault(builder.Configuration); builder.Services.AddKeyVault(builder.Configuration);
builder.Services.AddBlobStorage(builder.Configuration); builder.Services.AddBlobStorage(builder.Configuration);
builder.Services.AddRedis(builder.Configuration); //builder.Services.AddRedis(builder.Configuration);
builder.Services.AddMongoLayer(builder.Configuration); //builder.Services.AddMongoLayer(builder.Configuration);
builder.Services.AddSQLServer(builder.Configuration); //builder.Services.AddSQLServer(builder.Configuration);
builder.Services.AddDALLayerServices(builder.Configuration); builder.Services.AddDALLayerServices(builder.Configuration);
builder.Host.ConfigureServices((context, services) => builder.Host.ConfigureServices((context, services) =>

View File

@@ -7,5 +7,22 @@
}, },
"CacheSettings": { "CacheSettings": {
"DefaultCacheDurationInMinutes": 3 "DefaultCacheDurationInMinutes": 3
},
"Vault": {
"Address": "http://localhost:8200",
"Token": "hvs.kDZnAfrvfcMNrom6RmlEhZ7I",
"SecretMount": "secret"
},
"ConnectionStrings": {
"BlobStorage": "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;QueueEndpoint=http://127.0.0.1:10001/devstoreaccount1;TableEndpoint=http://127.0.0.1:10002/devstoreaccount1;"
},
"BlobStorage": {
"ContainerName": "blueprint",
"AccountName": "devstoreaccount1",
"AccountKey": "Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw=="
},
"ServiceSettings": {
"ApplicationName": "blueprint",
"LayerName": "dal"
} }
} }

View File

@@ -7,7 +7,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Blueprint.KeyVault" Version="0.0.1" /> <PackageReference Include="Blueprint.KeyVault" Version="0.0.3" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@@ -7,7 +7,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Blueprint.Mongo" Version="0.0.2" /> <PackageReference Include="Blueprint.Mongo" Version="0.0.3" />
<PackageReference Include="Blueprint.Redis" Version="0.0.1" /> <PackageReference Include="Blueprint.Redis" Version="0.0.1" />
<PackageReference Include="Mapster" Version="7.4.0" /> <PackageReference Include="Mapster" Version="7.4.0" />
</ItemGroup> </ItemGroup>

View File

@@ -10,7 +10,7 @@ namespace Core.Blueprint.DAL.Storage.Contracts
Task<IEnumerable<BlobFileAdapter>> GetBlobsListAsync(string? prefix); Task<IEnumerable<BlobFileAdapter>> GetBlobsListAsync(string? prefix);
Task<Response<BlobContentInfo>> UploadBlobAsync(string blobName, Stream content); Task<Response<BlobContentInfo>> UploadBlobAsync(string blobName, Stream content);
Task<BlobFileAdapter> UploadBlobAsync(BlobAddDto newBlob); Task<BlobFileAdapter> UploadBlobAsync(BlobAddDto newBlob);
BlobDownloadUriAdapter DownloadBlobAsync(string blobName); ValueTask<BlobDownloadUriAdapter> DownloadBlobAsync(string blobName);
Task<BlobFileAdapter?> DeleteBlobAsync(string fileName); Task<BlobFileAdapter?> DeleteBlobAsync(string fileName);
} }
} }

View File

@@ -11,7 +11,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Blueprint.Storage" Version="0.0.1" /> <PackageReference Include="Blueprint.Storage" Version="0.0.3" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@@ -27,9 +27,9 @@ namespace Core.Blueprint.DAL.Storage.Service
return await blobStorageProvider.ListBlobsAsync(prefix); return await blobStorageProvider.ListBlobsAsync(prefix);
} }
public BlobDownloadUriAdapter DownloadBlobAsync(string blobName) public async ValueTask<BlobDownloadUriAdapter> DownloadBlobAsync(string blobName)
{ {
var result = blobStorageProvider.GenerateBlobDownloadUri(blobName); var result = await blobStorageProvider.GenerateBlobDownloadUri(blobName);
return result; return result;
} }