From 37fe982ea9f08e48c75481008d614aaacf19a57d Mon Sep 17 00:00:00 2001 From: Are Almaas Date: Tue, 24 Sep 2024 13:33:06 +0200 Subject: [PATCH] fix(janitor): ensure Redis is configured correctly (#1182) ## Description ## Related Issue(s) - #{issue number} ## Verification - [ ] **Your** code builds clean without any errors or warnings - [ ] Manual testing done (required) - [ ] Relevant automated test added (if you find this hard, leave it and we'll help out) ## Documentation - [ ] Documentation is updated (either in `docs`-directory, Altinnpedia or a separate linked PR in [altinn-studio-docs.](https://github.com/Altinn/altinn-studio-docs), if applicable) ## Summary by CodeRabbit - **New Features** - Updated Redis configuration across all environments to require a connection string instead of a boolean flag. - Added placeholders for local secrets in production and staging configurations. - **Bug Fixes** - Enhanced configuration clarity by removing deprecated properties and introducing connection string requirements for Redis and database connections. --- .../sync-subject-resource-mappings-job/main.bicep | 14 ++++++++++++-- .../appsettings.Development.json | 2 +- .../appsettings.prod.json | 2 +- .../appsettings.staging.json | 2 +- .../appsettings.test.json | 2 +- 5 files changed, 16 insertions(+), 6 deletions(-) diff --git a/.azure/applications/sync-subject-resource-mappings-job/main.bicep b/.azure/applications/sync-subject-resource-mappings-job/main.bicep index 5bff21a7a..a2d6203f5 100644 --- a/.azure/applications/sync-subject-resource-mappings-job/main.bicep +++ b/.azure/applications/sync-subject-resource-mappings-job/main.bicep @@ -51,6 +51,10 @@ var containerAppEnvVars = [ name: 'Infrastructure__DialogDbConnectionString' secretRef: 'dbconnectionstring' } + { + name: 'Infrastructure__Redis__ConnectionString' + secretRef: 'redisconnectionstring' + } { name: 'DOTNET_ENVIRONMENT' value: environment @@ -61,13 +65,19 @@ var containerAppEnvVars = [ } ] +// Base URL for accessing secrets in the Key Vault // https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/bicep-functions-deployment#example-1 -var keyVaultUrl = 'https://${environmentKeyVaultName}${az.environment().suffixes.keyvaultDns}/secrets/dialogportenAdoConnectionString' +var keyVaultBaseUrl = 'https://${environmentKeyVaultName}${az.environment().suffixes.keyvaultDns}/secrets' var secrets = [ { name: 'dbconnectionstring' - keyVaultUrl: keyVaultUrl + keyVaultUrl: '${keyVaultBaseUrl}/dialogportenAdoConnectionString' + identity: 'System' + } + { + name: 'redisconnectionstring' + keyVaultUrl: '${keyVaultBaseUrl}/dialogportenRedisConnectionString' identity: 'System' } ] diff --git a/src/Digdir.Domain.Dialogporten.Janitor/appsettings.Development.json b/src/Digdir.Domain.Dialogporten.Janitor/appsettings.Development.json index 455c9320d..6bb8f2cbb 100644 --- a/src/Digdir.Domain.Dialogporten.Janitor/appsettings.Development.json +++ b/src/Digdir.Domain.Dialogporten.Janitor/appsettings.Development.json @@ -1,7 +1,7 @@ { "Infrastructure": { "Redis": { - "Enabled": false + "ConnectionString": "localhost:6379" }, "DialogDbConnectionString": "TODO: Add to local secrets", "Maskinporten": { diff --git a/src/Digdir.Domain.Dialogporten.Janitor/appsettings.prod.json b/src/Digdir.Domain.Dialogporten.Janitor/appsettings.prod.json index 1f42ddbc1..e3ef194e4 100644 --- a/src/Digdir.Domain.Dialogporten.Janitor/appsettings.prod.json +++ b/src/Digdir.Domain.Dialogporten.Janitor/appsettings.prod.json @@ -1,7 +1,7 @@ { "Infrastructure": { "Redis": { - "Enabled": false + "ConnectionString": "TODO: Add to local secrets" }, "DialogDbConnectionString": "TODO: Add to local secrets", "Maskinporten": { diff --git a/src/Digdir.Domain.Dialogporten.Janitor/appsettings.staging.json b/src/Digdir.Domain.Dialogporten.Janitor/appsettings.staging.json index 9881e95ce..73f82548d 100644 --- a/src/Digdir.Domain.Dialogporten.Janitor/appsettings.staging.json +++ b/src/Digdir.Domain.Dialogporten.Janitor/appsettings.staging.json @@ -1,7 +1,7 @@ { "Infrastructure": { "Redis": { - "Enabled": false + "ConnectionString": "TODO: Add to local secrets" }, "DialogDbConnectionString": "TODO: Add to local secrets", "Maskinporten": { diff --git a/src/Digdir.Domain.Dialogporten.Janitor/appsettings.test.json b/src/Digdir.Domain.Dialogporten.Janitor/appsettings.test.json index d8dd17eb6..e1659f553 100644 --- a/src/Digdir.Domain.Dialogporten.Janitor/appsettings.test.json +++ b/src/Digdir.Domain.Dialogporten.Janitor/appsettings.test.json @@ -1,7 +1,7 @@ { "Infrastructure": { "Redis": { - "Enabled": false + "ConnectionString": "TODO: Add to local secrets" }, "DialogDbConnectionString": "TODO: Add to local secrets", "Maskinporten": {