Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: enable eid logger feature flag #13588

Merged
merged 2 commits into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading