Skip to content

Commit

Permalink
testing and fix validation
Browse files Browse the repository at this point in the history
  • Loading branch information
arealmaas committed Mar 12, 2024
1 parent 2ab22d2 commit 4eb60f2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
using Digdir.Domain.Dialogporten.Infrastructure.Altinn.Events;
using Digdir.Domain.Dialogporten.Infrastructure.Altinn.OrganizationRegistry;
using Digdir.Domain.Dialogporten.Infrastructure.Altinn.ResourceRegistry;
using StackExchange.Redis;

namespace Digdir.Domain.Dialogporten.Infrastructure;

Expand Down Expand Up @@ -59,7 +60,7 @@ public static IServiceCollection AddInfrastructure(this IServiceCollection servi
var infrastructureSettings = infrastructureConfigurationSection.Get<InfrastructureSettings>()
?? throw new InvalidOperationException("Failed to get Redis settings. Infrastructure settings must not be null.");

if (infrastructureSettings.Redis.Enabled)
if (infrastructureSettings.Redis.Enabled == true)
{
services.AddStackExchangeRedisCache(options =>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public sealed class AltinnCdnPlatformSettings

public sealed class RedisSettings
{
public required bool Enabled { get; init; }
public required bool? Enabled { get; init; }
public required string ConnectionString { get; init; }
}

Expand Down Expand Up @@ -93,7 +93,7 @@ internal sealed class RedisSettingsValidator : AbstractValidator<RedisSettings>
{
public RedisSettingsValidator()
{
RuleFor(x => x.Enabled).NotEmpty();
RuleFor(x => x.Enabled).Must(x => x is false or true);
RuleFor(x => x.ConnectionString).NotEmpty();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
}
},
"Infrastructure": {
"Redis":{
"Enabled": false,
"ConnectionString": "redis://localhost:6379"
"Redis": {
"Enabled": true,
"ConnectionString": "localhost:6379"
},
"DialogDbConnectionString": "TODO: Add to local secrets",
// Settings from appsettings.json, environment variables or other configuration providers.
Expand Down

0 comments on commit 4eb60f2

Please sign in to comment.