From 69b15e84135abbe5290114e23d0b38efa65108c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20J=C3=B8rgen=20Skogstad?= Date: Tue, 27 Feb 2024 11:09:18 +0100 Subject: [PATCH] chore: Update README.md (#489) Co-authored-by: Svein Erik --- README.md | 18 +++++++++++------- .../README.md | 16 ++++++++-------- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 855a904bf..56684091f 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ docker compose up The APIs SwaggerUI should now be available at [localhost:7124/swagger](https://localhost:7214/swagger/index.html) ### Running the WebApi in an IDE -If you need do debug the WebApi project in an IDE, you can alternatively run docker compose without the WebAPI. +If you need to debug the WebApi project in an IDE, you can alternatively run docker compose without the WebAPI. First create a dotnet user secret for the DB connection string. ```powerhell @@ -59,21 +59,25 @@ dotnet ef migrations add TestMigration ``` ## Testing -Besides ordinary unit- and integration tests, there are test suites for both functional end-to-end testing implemented with [K6](https://k6.io/). +Besides ordinary unit and integration tests, there are test suites for both functional and non-functional end-to-end tests implemented with [K6](https://k6.io/). See `tests/k6/README.md` for more information. ## Development in local and test environments -To generate test tokens see https://github.com/Altinn/AltinnTestTools. There is a request in the Postman collection for this. +To generate test tokens see, https://github.com/Altinn/AltinnTestTools. There is a request in the Postman collection for this. ### Local development settings We are able to toggle some external resources in local development. This is done through the `appsettings.Development.json` file. The following settings are available: ```json "LocalDevelopment": { - "UseLocalDevelopmentUser": true, - "UseLocalDevelopmentResourceRegister": true, - "UseLocalDevelopmentCloudEventBus": true, - "DisableAuth": true + "UseLocalDevelopmentUser": true, + "UseLocalDevelopmentResourceRegister": true, + "UseLocalDevelopmentOrganizationRegister": true, + "UseLocalDevelopmentNameRegister": true, + "UseLocalDevelopmentAltinnAuthorization": true, + "UseLocalDevelopmentCloudEventBus": true, + "DisableShortCircuitOutboxDispatcher": true, + "DisableAuth": true } ``` Toggling these flags will enable/disable the external resources. The `DisableAuth` flag, for example, will disable authentication in the WebAPI project. This is useful when debugging the WebAPI project in an IDE. These settings will only be respected in the `Development` environment. diff --git a/src/Digdir.Tool.Dialogporten.SlackNotifier/README.md b/src/Digdir.Tool.Dialogporten.SlackNotifier/README.md index 78d5298a8..5726f5748 100644 --- a/src/Digdir.Tool.Dialogporten.SlackNotifier/README.md +++ b/src/Digdir.Tool.Dialogporten.SlackNotifier/README.md @@ -1,15 +1,15 @@ # Slack notifier -This function app is designed to convert Azure log alert v2 to a slack message formatted as an ascii table. +This function app is designed to convert Azure log alert v2 to a Slack message formatted as an ASCII table. When a Azure log alert triggers it notifies every consumer of the configured Azure action group. One of the consumers is this Azure function app which receives a HTTP Post request with the [log alert v2 format](https://learn.microsoft.com/en-us/azure/azure-monitor/alerts/alerts-common-schema#sample-log-alert-when-the-monitoringservice--log-alerts-v2). See [AzureAlertDto.cs](./Features/AzureAlertToSlackForwarder/AzureAlertDto.cs) for the format this function app expects. -The log alert v2 format does not include the actual query data which triggered the alert. Therefore the function app must fetch it by calling application insight. The data is then transformed to an ascii table and pushed to the configured slack webhook url through the field `exceptionReport`. It will also include a link to the application insight log with the following predefined query in the field named `link`: +The log alert v2 format does not include the actual query data which triggered the alert. Therefore the function app must fetch it by calling application insight. The data is then transformed to an ASCII table and pushed to the configured Slack webhook URL through the field `exceptionReport`. It will also include a link to the application insight log with the following predefined query in the field named `link`: ```KQL exceptions | order by timestamp desc ``` -The configured slack webhook will receive the following request: +The configured Slack webhook will receive the following request: ```HTTP HTTP POST [Slack_Webhook_Url] { @@ -20,21 +20,21 @@ HTTP POST [Slack_Webhook_Url] ## Local development 1. [Login to azure](https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication/?tabs=command-line#exploring-the-sequence-of-defaultazurecredential-authentication-methods) -2. Configure the slack webhook url +2. Configure the Slack webhook URL ```powerhell dotnet user-secrets set -p .\src\Digdir.Tool.Dialogporten.SlackNotifier\ "Slack:WebhookUrl" "SLACK_WEBHOOK_URL_HERE" ``` 3. Start the function app 4. Send a log alert v2 format to the app -The configured url doesn't have to be an actual slack workflow webhook url. It could point to an online webhook tester like https://webhook.site or a homemade webhook tester on your local machine. +The configured URL doesn't have to be an actual Slack workflow webhook URL. It could point to an online webhook tester like https://webhook.site or a homemade webhook tester on your local machine. ### Get a valid log alert v2 request This function app uses the links in the incoming alerts request to fetch data. Therefore the requests are app instance and time specific. The provided example request is most likely to be invalid by the time this article is read. Do the following to get a valid request: -1. Go to https://webhook.site and copy your unique url -2. Add the url as a webhook action of the azure action group +1. Go to https://webhook.site and copy your unique URL +2. Add the URL as a webhook action of the azure action group 3. Trigger the alert -4. Copy the request from https://webhook.site into postman. It may take several minutes for the alert to produce a request to the webhook. +4. Copy the request from https://webhook.site into Postman. It may take several minutes for the alert to produce a request to the webhook. 5. Delete the webhook action from the azure action group Example log alert v2 request: