From e117826c6a5915aaba44bd23fb24f1da998f9a4c Mon Sep 17 00:00:00 2001 From: Jonas F Date: Mon, 13 Jan 2025 18:49:26 +0100 Subject: [PATCH] Merge master in develop (#55) * Fix reachable and IP leak test (#44) * Fix reachable check Fixes failing reachable checks when Basic Authentication is enabled in Sonarr, Radarr, etc. * Add option to disable IP leak test * Revert "Fix reachable and IP leak test (#44)" (#46) This reverts commit 3f5d7bbef35ed7f480d06214cd40aa1334cf1390. * Release 0.6.1 (#48) * Fix typo * Fix typos * Fix typos * Fix typo * Clarify error message * Fix reachable and ipleak test (#47) * Fix reachable check Fixes failing reachable checks when Basic Authentication is enabled in Sonarr, Radarr, etc. * Add option to disable IP leak test --------- Co-authored-by: Jonas F * Add IpLeakTest environment variable to docker compose --------- Co-authored-by: akuntsch * Create Dockerfile.arm64 --------- Co-authored-by: akuntsch --- Dockerfile.arm64 | 11 ++++ .../Utilities/ServicesExtensions.cs | 2 +- .../GlobalInstanceOptionsValidator.cs | 60 +++++++++---------- docker-compose.yml | 2 +- 4 files changed, 43 insertions(+), 32 deletions(-) create mode 100644 Dockerfile.arm64 diff --git a/Dockerfile.arm64 b/Dockerfile.arm64 new file mode 100644 index 0000000..7cacd24 --- /dev/null +++ b/Dockerfile.arm64 @@ -0,0 +1,11 @@ +FROM --platform=linux/arm64 mcr.microsoft.com/dotnet/sdk:8.0 AS build-env +WORKDIR /app + +COPY . ./ +RUN dotnet restore +RUN dotnet publish -c Release -o out + +FROM --platform=linux/arm64 mcr.microsoft.com/dotnet/aspnet:8.0 +WORKDIR /app +COPY --from=build-env /app/out . +ENTRYPOINT ["dotnet", "UmlautAdaptarr.dll"] diff --git a/UmlautAdaptarr/Utilities/ServicesExtensions.cs b/UmlautAdaptarr/Utilities/ServicesExtensions.cs index 594859a..808906a 100644 --- a/UmlautAdaptarr/Utilities/ServicesExtensions.cs +++ b/UmlautAdaptarr/Utilities/ServicesExtensions.cs @@ -68,7 +68,7 @@ public static class ServicesExtensions Console.WriteLine(($"Property {failure.PropertyName } failed validation. Error was: {failure.ErrorMessage}")); } - throw new Exception("Please fix your environment variables and then Start UmlautAdaptarr again"); + throw new Exception("Please fix cour environment variables and then Start UmlautAdaptarr again"); } var instanceState = (bool)(typeof(TOptions).GetProperty("Enabled")?.GetValue(option, null) ?? false); diff --git a/UmlautAdaptarr/Validator/GlobalInstanceOptionsValidator.cs b/UmlautAdaptarr/Validator/GlobalInstanceOptionsValidator.cs index 8c08027..e4c90a8 100644 --- a/UmlautAdaptarr/Validator/GlobalInstanceOptionsValidator.cs +++ b/UmlautAdaptarr/Validator/GlobalInstanceOptionsValidator.cs @@ -35,38 +35,38 @@ public class GlobalInstanceOptionsValidator : AbstractValidator BeReachable(GlobalInstanceOptions opts, CancellationToken cancellationToken) - { - var endTime = DateTime.Now.AddMinutes(3); - var reachable = false; - var url = $"{opts.Host}/api?apikey={opts.ApiKey}"; + private static async Task BeReachable(GlobalInstanceOptions opts, CancellationToken cancellationToken) + { + var endTime = DateTime.Now.AddMinutes(3); + var reachable = false; + var url = $"{opts.Host}/api?apikey={opts.ApiKey}"; - while (DateTime.Now < endTime) - { - try - { - using var response = await httpClient.GetAsync(url, cancellationToken); - if (response.IsSuccessStatusCode) - { - reachable = true; - break; - } - else - { - Console.WriteLine($"Reachable check got unexpected status code {response.StatusCode}."); - } - } - catch (Exception ex) - { - Console.WriteLine(ex.Message); - } + while (DateTime.Now < endTime) + { + try + { + using var response = await httpClient.GetAsync(url, cancellationToken); + if (response.IsSuccessStatusCode) + { + reachable = true; + break; + } + else + { + Console.WriteLine($"Reachable check got unexpected status code {response.StatusCode}."); + } + } + catch (Exception ex) + { + Console.WriteLine(ex.Message); + } - // Wait for 15 seconds for next try - Console.WriteLine($"The URL \"{opts.Host}/api?apikey=[REDACTED]\" is not reachable. Next attempt in 15 seconds..."); - Thread.Sleep(15000); - } + // Wait for 15 seconds for next try + Console.WriteLine($"The URL \"{opts.Host}/api?apikey=[REDACTED]\" is not reachable. Next attempt in 15 seconds..."); + Thread.Sleep(15000); + } - return reachable; - } + return reachable; + } } \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index f8944ff..586a1b2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -23,7 +23,7 @@ services: - LIDARR__ENABLED=false - LIDARR__HOST=http://localhost:8686 - LIDARR__APIKEY=APIKEY - #- IpLeakTest_Enabled=false # uncomment and set to true to enable IP leak test + #- IpLeakTest__Enabled=false # uncomment and set to true to enable IP leak test ### example for multiple instances of same type #- SONARR__0__NAME=NAME 1 (optional) #- SONARR__0__ENABLED=false