Skip to content

BeaconSearch API Appsettings

Below is the documentation for the provided appsettings.json configuration file. This documentation aims to explain each section, helping you understand and configure the application settings effectively.

Overview

The appsettings.json file contains configuration settings for an ASP.NET Core application. The settings include message broker configuration (RabbitMQ), database connection strings, authentication details, and scheduler jobs.

1. RabbitMQ

{
  "RabbitMQ": {
    "HostName": "{Your hostname comes here}",
    "Username": "{Your username comes here}",
    "Password": "{Your password comes here}",
    "ExchangeType": "fanout",
    "ExchangeName": "content_exchange"
  }
}

Docker-compose form of environment variables.

environment:
  RabbitMQ__HostName:"{Your hostname comes here}"
  RabbitMQ__Username:"{Your username comes here}"
  RabbitMQ__Password:"{Your password comes here}"
  RabbitMQ__ExchangeType:"fanout"
  RabbitMQ__ExchangeName:"content_exchange"
  • HostName: The host name or IP address of the RabbitMQ service.
  • Username: RabbitMQ username.
  • Password: RabbitMQ password.
  • ExchangeType: The exchange type for messaging; "fanout" is used here.
  • ExchangeName: The name of the exchange to which messages will be sent.

2. ConnectionStrings

{
  "ConnectionStrings": {
    "DefaultConnection": "{Your connection string comes here}"
  }
}

Docker-compose form of environment variables.

environment:
  ConnectionStrings__DefaultConnection:"{Your connection string comes here}"
  • DefaultConnection: This is a placeholder for your actual database connection string. It is used to connect the application to a database.

3. Auth

{
  "Auth": {
    "JWT": {
      "PointrClientSecret": "{Your JWT client secret here}"
    }
  }
}

Docker-compose form of environment variables.

environment:
  Auth__JWT__PointrClientSecret:"{Your JWT client secret here}"
  • PointrClientSecret: The client secret used for JWT authentication.

4. SchedulerJob

{
  "SchedulerJob": {
    "BeaconUpdateIntervalMinutes": 1
  }
}

Docker-compose form of environment variables.

environment:
  SchedulerJob__BeaconUpdateIntervalMinutes:"1"
  • BeaconUpdateIntervalMinutes: Specifies the interval, in minutes, at which the application updates or checks for beacon signals. The value 1 means the scheduler will run every minute.

5. Serilog

{
  "Serilog": {
    "Using": [ "Serilog.Sinks.Console" ],
    "MinimumLevel": {
      "Default": "Information",
      "Override": {
        "Microsoft": "Information",
        "System": "Information",
        "Microsoft.EntityFrameworkCore.Database.Command": "Warning",
        "Microsoft.AspNetCore.Mvc.Infrastructure.ObjectResultExecutor": "Warning"
      }
    },
    "WriteTo": [
      {
        "Name": "Console",
        "Args": {
          "theme": "Serilog.Sinks.SystemConsole.Themes.SystemConsoleTheme::Literate, Serilog.Sinks.Console",
          "outputTemplate": "[{Level} {@Timestamp:yyyy-MM-dd HH:mm:ss}] [Message: {Message} {Exception}]{NewLine}"
        }
      },
      {
        "Name": "CustomFile",
        "Args": {
          "path": "logs/log-.txt"
        }
      }    
    ],
    "Enrich": ["FromLogContext", "WithMachineName", "WithProcessId", "WithThreadId"],
    "Destructure": [
      {
        "Name": "ToMaximumDepth",
        "Args": { "maximumDestructuringDepth": 20 }
      },
      {
        "Name": "ToMaximumStringLength",
        "Args": { "maximumStringLength": 5000 }
      },
      {
        "Name": "ToMaximumCollectionCount",
        "Args": { "maximumCollectionCount": 20 }
      }
    ],
    "Properties": {
      "Application": "Pointr.Microservice.BeaconSearch.API"
    }
  }
}

Docker-compose form of environment variables.

environment:
  Serilog__Using__0: "Serilog.Sinks.Console"
  Serilog__MinimumLevel__Default: "Information"
  Serilog__MinimumLevel__Override__Microsoft: "Information"
  Serilog__MinimumLevel__Override__System: "Information"
  Serilog__MinimumLevel__Override__Microsoft.EntityFrameworkCore.Database.Command: "Warning"
  Serilog__MinimumLevel__Override__Microsoft.AspNetCore.Mvc.Infrastructure.ObjectResultExecutor: "Warning"
  Serilog__WriteTo__0__Name: "Console"
  Serilog__WriteTo__0__Args__theme: "Serilog.Sinks.SystemConsole.Themes.SystemConsoleTheme::Literate, Serilog.Sinks.Console"
  Serilog__WriteTo__0__Args__outputTemplate: "[{Level} {@Timestamp:yyyy-MM-dd HH:mm:ss}] [Message: {Message} {Exception}]{NewLine}"
  Serilog__WriteTo__1__Name: "CustomFile"
  Serilog__WriteTo__1__Args__path: "logs/log-.txt"
  Serilog__Enrich__0: "FromLogContext"
  Serilog__Enrich__1: "WithMachineName"
  Serilog__Enrich__2: "WithProcessId"
  Serilog__Enrich__3: "WithThreadId"
  Serilog__Destructure__0__Name: "ToMaximumDepth"
  Serilog__Destructure__0__Args__maximumDestructuringDepth: "20"
  Serilog__Destructure__1__Name: "ToMaximumStringLength"
  Serilog__Destructure__1__Args__maximumStringLength: "5000"
  Serilog__Destructure__2__Name: "ToMaximumCollectionCount"
  Serilog__Destructure__2__Args__maximumCollectionCount: "20"
  Serilog__Properties__Application: "Pointr.Microservice.BeaconSearch.API"
  • Using: Specifies the Serilog sinks in use, such as "Serilog.Sinks.Console" for console logging.
  • MinimumLevel: Sets the minimum logging level to Warning, with specific overrides available for Microsoft and System namespaces.
  • WriteTo: Defines where log output is sent, using a compact JSON formatter for console output.
  • Enrich: Add contextual data to logs, such as machine name and process ID.
  • Destructure: Configures destructuring with limits on depth, string length, and collection count to manage log size and detail.
  • Properties: Additional properties to include in every log, like specifying the application name.

Notes:

This documentation is designed to make the configuration more comprehensible and guide you in making necessary adjustments where needed. It includes explanations of what each setting is for and important considerations when making changes.