diff --git a/services/recovery/Grid.Bot.Recovery.csproj b/services/recovery/Grid.Bot.Recovery.csproj
index caaa3d28..2612f24c 100644
--- a/services/recovery/Grid.Bot.Recovery.csproj
+++ b/services/recovery/Grid.Bot.Recovery.csproj
@@ -12,10 +12,10 @@
Recovery executable for the MFDLABS grid-bot.
-
+
-
+
diff --git a/shared/settings/Shared.Settings.csproj b/shared/settings/Shared.Settings.csproj
index f2bb1789..98c42482 100644
--- a/shared/settings/Shared.Settings.csproj
+++ b/shared/settings/Shared.Settings.csproj
@@ -16,7 +16,7 @@
-
+
@@ -45,4 +45,4 @@
-
\ No newline at end of file
+
diff --git a/src/Runner.cs b/src/Runner.cs
index be229017..33454bc9 100644
--- a/src/Runner.cs
+++ b/src/Runner.cs
@@ -203,31 +203,39 @@ private static IEnumerable GetSettingsProviders()
var assembly = Assembly.GetAssembly(typeof(BaseSettingsProvider));
var ns = typeof(BaseSettingsProvider).Namespace;
- var singletons = assembly
+ var types = assembly
.GetTypes()
.Where(t => string.Equals(t.Namespace, ns, StringComparison.Ordinal) &&
- t.BaseType.Name == typeof(BaseSettingsProvider).Name) // finicky
- .Select(t =>
+ t.BaseType.Name == typeof(BaseSettingsProvider).Name)
+ .ToList(); // finicky
+
+ var singletons = new List();
+
+ foreach (var t in types)
+ {
+ // Construct the singleton.
+ var constructor = t.GetConstructor(Type.EmptyTypes);
+ if (constructor == null)
{
- // Construct the singleton.
- var constructor = t.GetConstructor(Type.EmptyTypes);
- if (constructor == null)
- {
- Console.Error.WriteLine("Provider {0} did not expose a public constructor!", t.FullName);
+ Console.Error.WriteLine("Provider {0} did not expose a public constructor!", t.FullName);
- return null;
- }
+ singletons.Add(null);
- var singleton = constructor.Invoke(null);
- if (singleton == null)
- {
- Console.Error.WriteLine("Provider {0} did not construct a singleton!", t.FullName);
+ continue;
+ }
+
+ var singleton = constructor.Invoke(null);
+ if (singleton == null || singleton is not IConfigurationProvider provider)
+ {
+ Console.Error.WriteLine("Provider {0} did not construct a singleton!", t.FullName);
- return null;
- }
+ singletons.Add(null);
- return singleton;
- });
+ continue;
+ }
+
+ singletons.Add(provider);
+ }
return singletons.Cast();
}
@@ -383,10 +391,17 @@ private static void StartGrpcServer(IEnumerable args, IServiceProvider s
options.ConfigureEndpointDefaults(listenOptions =>
{
listenOptions.Protocols = HttpProtocols.Http2;
- listenOptions.UseHttps(globalSettings.GrpcServerCertificatePath, globalSettings.GrpcServerCertificatePassword, httpsOptions =>
+
+ try
+ {
+ listenOptions.UseHttps(globalSettings.GrpcServerCertificatePath, globalSettings.GrpcServerCertificatePassword, httpsOptions =>
+ {
+ httpsOptions.SslProtocols = SslProtocols.Tls13 | SslProtocols.Tls12;
+ });
+ } catch (Exception ex)
{
- httpsOptions.SslProtocols = SslProtocols.Tls13 | SslProtocols.Tls12;
- });
+ logger.Warning("Failed to configure gRPC with HTTPS because: {0}. Will resort to insecure host instead!", ex.Message);
+ }
});
});