This commit is contained in:
Курнат Андрей
2026-04-04 16:19:25 +03:00
parent 5a55bc5f4c
commit 84f2308e65
5 changed files with 89 additions and 47 deletions

View File

@@ -15,7 +15,15 @@ internal sealed class PdfStorageService
_client = client;
var options = configuration.GetSection("Crawler").Get<CrawlerOptions>()
?? throw new InvalidOperationException("Раздел Crawler не найден в appsettings.json.");
_rootPath = Environment.ExpandEnvironmentVariables(options.PdfStoragePath);
var configuredPath = Environment.ExpandEnvironmentVariables(options.PdfStoragePath ?? string.Empty).Trim();
if (string.IsNullOrWhiteSpace(configuredPath))
{
configuredPath = "PdfStore";
}
_rootPath = Path.IsPathRooted(configuredPath)
? configuredPath
: Path.GetFullPath(Path.Combine(AppContext.BaseDirectory, configuredPath));
Directory.CreateDirectory(_rootPath);
}