fixed port configuration and logs

This commit is contained in:
Flaminel
2025-06-21 20:19:05 +03:00
parent a61a10af8f
commit 8f34bdc780
3 changed files with 4 additions and 20 deletions

View File

@@ -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

View File

@@ -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<string>("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<string>("HTTP_PORTS"), basePath ?? "/");
// Initialize the host
await app.Init();

View File

@@ -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