| | | 1 | | using Anichron.Infrastructure.Configuration; |
| | | 2 | | using System.IO.Abstractions; |
| | | 3 | | |
| | | 4 | | namespace Anichron.Worker.Infrastructure; |
| | | 5 | | |
| | | 6 | | public static class HostApplicationBuilderExtensions |
| | | 7 | | { |
| | | 8 | | extension(HostApplicationBuilder builder) |
| | | 9 | | { |
| | | 10 | | public HostApplicationBuilder AddAppConfiguration() |
| | 0 | 11 | | { |
| | 0 | 12 | | var iniPath = Path.Combine(builder.Environment.ContentRootPath, "configuration", "app.ini"); |
| | 0 | 13 | | new AppIniInitializer(new FileSystem()).EnsureUpToDate(iniPath, |
| | 0 | 14 | | [ |
| | 0 | 15 | | new IniEntry("Worker", "User", () => string.Empty), |
| | 0 | 16 | | new IniEntry("Worker", "RootPath", () => "/data/originals"), |
| | 0 | 17 | | new IniEntry("Worker", "CrawlIntervalHours", () => "4"), |
| | 0 | 18 | | new IniEntry("Worker", "MaxConcurrentFiles", () => "4"), |
| | 0 | 19 | | new IniEntry("Worker", "TokenCleanupIntervalHours", () => "24"), |
| | 0 | 20 | | new IniEntry("Worker", "ProxyPath", () => "/data/proxies"), |
| | 0 | 21 | | new IniEntry("Worker", "ThumbnailMaxWidth", () => "300"), |
| | 0 | 22 | | new IniEntry("Worker", "ThumbnailJpegQuality", () => "75"), |
| | 0 | 23 | | new IniEntry("Worker", "PreviewMaxWidth", () => "1920"), |
| | 0 | 24 | | new IniEntry("Worker", "PreviewJpegQuality", () => "85"), |
| | 0 | 25 | | new IniEntry("Worker", "BlurhashSampleWidth", () => "64"), |
| | 0 | 26 | | new IniEntry("Worker", "FfmpegPath", () => "ffmpeg"), |
| | 0 | 27 | | new IniEntry("Worker", "VideoMaxHeight", () => "720"), |
| | 0 | 28 | | new IniEntry("Worker", "VideoBitrateKbps", () => "2000"), |
| | 0 | 29 | | ]); |
| | 0 | 30 | | builder.Configuration.AddIniFile(iniPath, optional: false, reloadOnChange: false); |
| | 0 | 31 | | builder.Configuration.AddEnvironmentVariables(); |
| | 0 | 32 | | return builder; |
| | | 33 | | } |
| | | 34 | | } |
| | | 35 | | } |