Skip to content

Commit

Permalink
chore: enable eid logger feature flag (#13588)
Browse files Browse the repository at this point in the history
  • Loading branch information
mirkoSekulic authored Oct 8, 2024
1 parent 99d9790 commit e061605
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,12 @@ await _applicationInformationService


var createdEntity = await _deploymentRepository.Create(deploymentEntity);
await PublishAppDeployedEvent(deploymentEntity);
await PublishAppDeployedEvent(deploymentEntity, cancellationToken);
return createdEntity;
}

// Publish app deployed event
private async Task PublishAppDeployedEvent(DeploymentEntity deploymentEntity)
private async Task PublishAppDeployedEvent(DeploymentEntity deploymentEntity, CancellationToken cancellationToken)
{
try
{
Expand All @@ -104,7 +104,7 @@ await _mediatr.Publish(new AppDeployedEvent
EditingContext = AltinnRepoContext.FromOrgRepo(deploymentEntity.Org, deploymentEntity.App),
AppsEnvironment = deploymentEntity.EnvName,
DeployType = newApp ? DeployType.NewApp : DeployType.ExistingApp
});
}, cancellationToken);
}
catch (Exception e)
{
Expand Down
16 changes: 14 additions & 2 deletions backend/src/Designer/TypedHttpClients/EidLogger/EidLoggerClient.cs
Original file line number Diff line number Diff line change
@@ -1,20 +1,32 @@
using System.Net.Http;
using System.Net.Mime;
using System.Text;
using System.Text.Json;
using System.Threading;
using System.Threading.Tasks;

namespace Altinn.Studio.Designer.TypedHttpClients.EidLogger;

public class EidLoggerClient : IEidLoggerClient
{
private readonly HttpClient _httpClient;
private readonly JsonSerializerOptions _jsonSerializerOptions = new JsonSerializerOptions
{
PropertyNamingPolicy = JsonNamingPolicy.CamelCase
};

public EidLoggerClient(HttpClient httpClient)
{
_httpClient = httpClient;
}

public async Task Log(EidLogRequest request)
public async Task Log(EidLogRequest request, CancellationToken cancellationToken = default)
{
var response = await _httpClient.PostAsJsonAsync("eid-event-log", request);
using var payloadContent = new StringContent(JsonSerializer.Serialize(request, _jsonSerializerOptions),
Encoding.UTF8,
MediaTypeNames.Application.Json);

using var response = await _httpClient.PostAsync("eid-event-log", payloadContent, cancellationToken);
response.EnsureSuccessStatusCode();
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
using System.Threading;
using System.Threading.Tasks;

namespace Altinn.Studio.Designer.TypedHttpClients.EidLogger;

public interface IEidLoggerClient
{
public Task Log(EidLogRequest request);
public Task Log(EidLogRequest request, CancellationToken cancellationToken = default);
}
6 changes: 6 additions & 0 deletions charts/altinn-designer/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ environmentVariables:
value: 59
- name: FeatureManagement__AnsattPorten
value: "false"
- name: FeatureManagement__EidLogging
value: "true"
staging:
- name: ASPNETCORE_ENVIRONMENT
value: Staging
Expand Down Expand Up @@ -87,6 +89,8 @@ environmentVariables:
value: 59
- name: FeatureManagement__AnsattPorten
value: "false"
- name: FeatureManagement__EidLogging
value: "true"
prod:
- name: ASPNETCORE_ENVIRONMENT
value: Production
Expand Down Expand Up @@ -118,6 +122,8 @@ environmentVariables:
value: 59
- name: FeatureManagement__AnsattPorten
value: "false"
- name: FeatureManagement__EidLogging
value: "true"

dbMigrationsEnvironmentVariablesSecretName: altinn-designer-db-migrations-secret

Expand Down

0 comments on commit e061605

Please sign in to comment.