Add more logging to reachable check

This commit is contained in:
pcjones
2024-10-21 23:32:18 +02:00
parent b8a1c64039
commit 29da771484
3 changed files with 10 additions and 6 deletions

View File

@@ -46,19 +46,23 @@ public class GlobalInstanceOptionsValidator : AbstractValidator<GlobalInstanceOp
try
{
using var response = await httpClient.GetAsync(url, cancellationToken);
reachable = response.StatusCode == HttpStatusCode.OK;
if (response.IsSuccessStatusCode)
{
reachable = true;
break;
}
}
catch
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}\" is not reachable. Next attempt in 15 seconds...");
Console.WriteLine($"The URL \"{opts.Host}/api?apikey=[REDACTED]\" is not reachable. Next attempt in 15 seconds...");
Thread.Sleep(15000);
}

View File

@@ -67,7 +67,7 @@
},
"IpLeakTest": {
// Docker Environment Variables:
// - IpLeakTest: false (set to true to enable)
// - IpLeakTest__Enabled: false (set to true to enable)
"Enabled": false
}
}

View File

@@ -23,7 +23,7 @@ services:
- LIDARR__ENABLED=false
- LIDARR__HOST=http://localhost:8686
- LIDARR__APIKEY=APIKEY
#- IpLeakTest=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