mirror of
https://github.com/Cleanuparr/Cleanuparr.git
synced 2026-06-10 14:55:34 -04:00
fixed port configuration and logs
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user