From 899e6350e730856f2a991b00b09826702198b69f Mon Sep 17 00:00:00 2001 From: Kevin Hahn Date: Thu, 23 May 2024 10:38:37 -0600 Subject: [PATCH] allow versions of hg container and api to not match in develop environment --- .idea/.idea.LexBox/.idea/indexLayout.xml | 1 + backend/LexBoxApi/Services/HgWebHealthCheck.cs | 8 +++++--- backend/LexCore/Config/HgConfig.cs | 1 + deployment/develop/lexbox-deployment.patch.yaml | 2 ++ 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.idea/.idea.LexBox/.idea/indexLayout.xml b/.idea/.idea.LexBox/.idea/indexLayout.xml index bfb0056af..3a934820b 100644 --- a/.idea/.idea.LexBox/.idea/indexLayout.xml +++ b/.idea/.idea.LexBox/.idea/indexLayout.xml @@ -2,6 +2,7 @@ + deployment frontend hasura hg-web diff --git a/backend/LexBoxApi/Services/HgWebHealthCheck.cs b/backend/LexBoxApi/Services/HgWebHealthCheck.cs index 1e29eb7f8..14e97a737 100644 --- a/backend/LexBoxApi/Services/HgWebHealthCheck.cs +++ b/backend/LexBoxApi/Services/HgWebHealthCheck.cs @@ -1,9 +1,11 @@ -using LexCore.ServiceInterfaces; +using LexCore.Config; +using LexCore.ServiceInterfaces; using Microsoft.Extensions.Diagnostics.HealthChecks; +using Microsoft.Extensions.Options; namespace LexBoxApi.Services; -public class HgWebHealthCheck(IHgService hgService) : IHealthCheck +public class HgWebHealthCheck(IHgService hgService, IOptions hgOptions) : IHealthCheck { public async Task CheckHealthAsync(HealthCheckContext context, CancellationToken cancellationToken = new()) @@ -13,7 +15,7 @@ public async Task CheckHealthAsync(HealthCheckContext context { return HealthCheckResult.Unhealthy(); } - if (version != AppVersionService.Version) + if (hgOptions.Value.RequireContainerVersionMatch && version != AppVersionService.Version) { return HealthCheckResult.Degraded( $"api version: '{AppVersionService.Version}' hg version: '{version}' mismatch"); diff --git a/backend/LexCore/Config/HgConfig.cs b/backend/LexCore/Config/HgConfig.cs index 23f7061a7..843517769 100644 --- a/backend/LexCore/Config/HgConfig.cs +++ b/backend/LexCore/Config/HgConfig.cs @@ -16,4 +16,5 @@ public class HgConfig [Required, Url] public required string HgResumableUrl { get; init; } public bool AutoUpdateLexEntryCountOnSendReceive { get; init; } = false; + public bool RequireContainerVersionMatch { get; init; } = true; } diff --git a/deployment/develop/lexbox-deployment.patch.yaml b/deployment/develop/lexbox-deployment.patch.yaml index e62ccdd99..58d016e9c 100644 --- a/deployment/develop/lexbox-deployment.patch.yaml +++ b/deployment/develop/lexbox-deployment.patch.yaml @@ -24,3 +24,5 @@ spec: value: "Language Depot (Develop) " - name: Email__BaseUrl value: "https://develop.lexbox.org" + - name: HgConfig__RequireContainerVersionMatch + value: "false"