File tree Expand file tree Collapse file tree 3 files changed +14
-2
lines changed
code/backend/Cleanuparr.Api Expand file tree Collapse file tree 3 files changed +14
-2
lines changed Original file line number Diff line number Diff line change 2323 <IncludeAssets >runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets >
2424 </PackageReference >
2525 <PackageReference Include =" Microsoft.Extensions.Hosting" Version =" 9.0.6" />
26+ <PackageReference Include =" Microsoft.Extensions.Hosting.WindowsServices" Version =" 9.0.6" />
2627 <PackageReference Include =" Microsoft.Extensions.Http" Version =" 9.0.6" />
2728 <PackageReference Include =" Microsoft.Extensions.Http.Polly" Version =" 9.0.6" />
2829 <PackageReference Include =" Quartz" Version =" 3.14.0" />
Original file line number Diff line number Diff line change 1+ using System . Runtime . InteropServices ;
12using System . Text . Json . Serialization ;
23using Cleanuparr . Api ;
34using Cleanuparr . Api . DependencyInjection ;
5657// Add logging with proper service provider
5758builder . Logging . AddLogging ( ) ;
5859
60+ if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) )
61+ {
62+ builder . Host . UseWindowsService ( options =>
63+ {
64+ options . ServiceName = "Cleanuparr" ;
65+ } ) ;
66+ builder . Logging . AddEventLog ( settings =>
67+ {
68+ settings . SourceName = "Cleanuparr" ;
69+ } ) ;
70+ }
71+
5972var app = builder . Build ( ) ;
6073
6174// Configure BASE_PATH immediately after app build and before any other configuration
Original file line number Diff line number Diff line change @@ -47,7 +47,6 @@ Source: "appsettings.json"; DestDir: "{app}"; Flags: ignoreversion; AfterInstall
4747
4848[Dirs]
4949Name : " {app} \config" ; Permissions: everyone-full
50- Name : " {app} \logs" ; Permissions: everyone-full
5150
5251[Icons]
5352Name : " {group} \{#MyAppName}" ; Filename : " {app} \{#MyAppExeName}"
@@ -85,7 +84,6 @@ procedure CreateConfigDirs;
8584begin
8685 // Create necessary directories with proper permissions
8786 ForceDirectories(ExpandConstant(' {app}\config' ));
88- ForceDirectories(ExpandConstant(' {app}\logs' ));
8987end ;
9088
9189function ServiceExists (ServiceName: string): Boolean;
You can’t perform that action at this time.
0 commit comments