diff --git a/.gitignore b/.gitignore index fc614d65..ca13ffd6 100644 --- a/.gitignore +++ b/.gitignore @@ -339,4 +339,5 @@ ASALocalRun/ .localhistory/ # BeatPulse healthcheck temp database -healthchecksdb \ No newline at end of file +healthchecksdb +data/ \ No newline at end of file diff --git a/AsbCloudInfrastructure/Repository/FileStorageRepository.cs b/AsbCloudInfrastructure/Repository/FileStorageRepository.cs index 7fad445b..50e9bff5 100644 --- a/AsbCloudInfrastructure/Repository/FileStorageRepository.cs +++ b/AsbCloudInfrastructure/Repository/FileStorageRepository.cs @@ -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 /// /// Директория хранения файлов /// - private readonly string RootPath = "files"; - public FileStorageRepository() + public string RootPath { get; } + + + public FileStorageRepository(IConfiguration configuration) { + RootPath = configuration.GetValue("ContentPath") ?? "../data"; } public async Task SaveFileAsync(string filePathRec, Stream fileStreamSrc, CancellationToken token) diff --git a/AsbCloudWebApi/appsettings.json b/AsbCloudWebApi/appsettings.json index 96a3f3bf..72d50f57 100644 --- a/AsbCloudWebApi/appsettings.json +++ b/AsbCloudWebApi/appsettings.json @@ -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": "", - // "KeyPath": "", - // "Password": "" - // } - // } - // } - //} + "Urls": "http://0.0.0.0:5000" }