diff --git a/code/Dockerfile b/code/Dockerfile index a052c0b8..1099f03c 100644 --- a/code/Dockerfile +++ b/code/Dockerfile @@ -51,7 +51,8 @@ RUN apt-get update && apt-get install -y \ ENV PUID=1000 \ PGID=1000 \ UMASK=022 \ - TZ=Etc/UTC + TZ=Etc/UTC \ + HTTP_PORTS=11011 # Fix FileSystemWatcher in Docker: https://github.com/dotnet/dotnet-docker/issues/3546 ENV DOTNET_USE_POLLING_FILE_WATCHER=true diff --git a/code/backend/Cleanuparr.Api/Program.cs b/code/backend/Cleanuparr.Api/Program.cs index f09f8ac7..dc488f88 100644 --- a/code/backend/Cleanuparr.Api/Program.cs +++ b/code/backend/Cleanuparr.Api/Program.cs @@ -10,23 +10,6 @@ var builder = WebApplication.CreateBuilder(args); builder.Configuration .AddJsonFile(Path.Combine(ConfigurationPathProvider.GetConfigPath(), "cleanuparr.json"), optional: true, reloadOnChange: true); -// Configure PORT before building the app -string? portConfig = builder.Configuration.GetValue("PORT"); - -// Validate the port configuration -var portValidationResult = PortValidator.Validate(portConfig); -if (!portValidationResult.IsValid) -{ - throw new InvalidOperationException($"Invalid PORT configuration: {portValidationResult.ErrorMessage}"); -} - -// Get the normalized port (uses default if null/empty) -int port = PortValidator.Normalize(portConfig); - -// Configure the URLs for the application -string[] urls = [$"http://[::]:{port}"]; -builder.WebHost.UseUrls(urls); - builder.Services.AddResponseCompression(options => { options.EnableForHttps = true; @@ -104,7 +87,7 @@ if (basePath is not null) } } -logger.LogInformation("Server configuration: PORT={port}, BASE_PATH={basePath}", port, basePath ?? "/"); +logger.LogInformation("Server configuration: PORT={port}, BASE_PATH={basePath}", app.Configuration.GetValue("HTTP_PORTS"), basePath ?? "/"); // Initialize the host await app.Init(); diff --git a/code/frontend/src/app/core/services/base-path.service.ts b/code/frontend/src/app/core/services/base-path.service.ts index 12edb5ae..2be09d15 100644 --- a/code/frontend/src/app/core/services/base-path.service.ts +++ b/code/frontend/src/app/core/services/base-path.service.ts @@ -11,7 +11,7 @@ export class BasePathService { getBasePath(): string { // If in development mode, use the local API if (isDevMode()) { - return `http://localhost:11011`; + return `http://localhost:5000`; } // Use the server-injected base path or fallback to root