Merge pull request 'feature/27778811-file-storage Переместить файловое хранилище из директории с программой' (#196) from feature/27778811-file-storage into dev

Reviewed-on: http://test.digitaldrilling.ru:8080/DDrilling/AsbCloudServer/pulls/196
This commit is contained in:
Никита Фролов 2024-01-21 12:22:04 +05:00
commit e027e27b5c
3 changed files with 11 additions and 30 deletions

3
.gitignore vendored
View File

@ -339,4 +339,5 @@ ASALocalRun/
.localhistory/
# BeatPulse healthcheck temp database
healthchecksdb
healthchecksdb
data/

View File

@ -6,6 +6,8 @@ using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Configuration;
namespace AsbCloudInfrastructure.Repository;
@ -14,10 +16,13 @@ public class FileStorageRepository : IFileStorageRepository
/// <summary>
/// Директория хранения файлов
/// </summary>
private readonly string RootPath = "files";
public FileStorageRepository()
public string RootPath { get; }
public FileStorageRepository(IConfiguration configuration)
{
RootPath = configuration.GetValue<string>("ContentPath") ?? "../data";
}
public async Task SaveFileAsync(string filePathRec, Stream fileStreamSrc, CancellationToken token)

View File

@ -13,9 +13,7 @@
"LocalConnection": "Host=localhost;Database=postgres;Username=postgres;Password=q;Persist Security Info=True"
},
"AllowedHosts": "*",
//"userLimits": {
// "parallelRequestsToController": 5
//},
"ContentPath": "../data",
"email": {
"smtpServer": "smtp.timeweb.ru",
"sender": "bot@digitaldrilling.ru",
@ -28,28 +26,5 @@
},
"DirectoryNameHelpPageFiles": "helpPages",
"DirectoryManualFiles": "manuals",
"Urls": "http://0.0.0.0:5000" //;https://0.0.0.0:5001" //,
// See https man: https://docs.microsoft.com/en-us/aspnet/core/fundamentals/servers/kestrel/endpoints?view=aspnetcore-6.0
//"Kestrel": {
// "Endpoints": {
// "Http": {
// "Url": "http://0.0.0.0:5000"
// },
// "Https": {
// "Url": "https://0.0.0.0:5001",
// "Certificate": {
// // use store
// "Subject": "localhost",
// "Store": "My",
// "Location": "CurrentUser",
// "AllowInvalid": true
// // use file
// "Path": "<path to .pem/.crt file>",
// "KeyPath": "<path to .key file>",
// "Password": "<certificate password>"
// }
// }
// }
//}
"Urls": "http://0.0.0.0:5000"
}