Skip to content

Konfiguration CMI.PushService

appsettings.json

Die Konfiguration erfolgt in der Datei appsettings.json. Die nachfolgenden Unterkapitel beschreiben jeweils einen Toplevel-Eintrag.

Hinweis: Pfadangaben müssen mit doppelten Backslashes geschrieben werden.

urls

"urls": "https://push.kunde.ch:443",

Dies ist ein Standard-Konfigurationseintrag von asp.net core. Hier wird angeben über welchen Port der Service angesprochen wird.

Wichtig: Dieser Endpunkt muss nicht nur vom WebClient (Browser) erreichbar sein, sondern auch vom CMI Intentity Server (STS).

Logging

"Logging": {
    "LogLevel": {
        "Default": "Information",
        "System": "Warning",
        "Microsoft": "Warning"
    }
},

Dies ist ein Standard-Konfigurationseintrag von asp.net core. Hier wird Logging-Verhalten konfiguriert. Für Details siehe Logging in .NET Core and ASP.NET Core

Serilog

    "Serilog": {
        "Using": [
            "Serilog.Sinks.Console",
            "Serilog.Sinks.File"
        ],
        "MinimumLevel": {
            "Default": "Information",
            "Override": {
                "System": "Warning",
                "Microsoft": "Warning",
                "Microsoft.Hosting.Lifetime": "Information",
                "Microsoft.AspNetCore.Authentication": "Information"
            }
        },
        "WriteTo": [
            {
                "Name": "File",
                "Args": {
                    "rollingInterval": "Day",
                    "rollOnFileSizeLimit": true,
                    "fileSizeLimitBytes": 100000000,
                    "path": "C:\\WebServer\\CMI.Push.Service\\_trace\\push_service_log-.txt"
                }
            }
        ],
        "Properties": {
            "Application": "CMI.Push.Service"
        }
    }

PushService

"PushService": {
    "ApiBaseUrl": "https://mf1.cmiag.ch/develop/private/api",
    "AllowedClients": [
        "http://localhost:4200",
        "https://mobile-first-develop.azurewebsites.net"
    ],
    "AllowDebug": true,
    "EnableDetailedErrors": false,
    "PurgeRestoreStorageAfterSeconds": 180
},

Unter ApiBaseUrl ist die vollständige URL vom OWIN Private Endpoint vom Server Service anzugeben (inkl. Protokoll und Port).
Falls ein Relay Server im Einsatz ist, muss die URL von diesem angegeben werden.

Authentication

"Authentication": {
    "Authority": "https://mf1.cmiag.ch/stsdevelop/identity",
    "Audience": "push-api"
},

Beispiel-Datei

{
    "PushService": {
        "ApiBaseUrl": "https://mf1.cmiag.ch/develop/private/api/",
        "AllowedClients": [
            "http://localhost:4200",
            "http://localhost:6565",
            "https://mobile-first-develop.azurewebsites.net"
        ],
        "PurgeRestoreStorageAfterSeconds": 180,
        "AllowDebug": true,
        "EnableDetailedErrors":  true
    },
    "Serilog": {
        "MinimumLevel": {
            "Default": "Debug"
        },
        "WriteTo": [
            {
                "Name": "File",
                "Args": {
                    "rollingInterval": "Day",
                    "rollOnFileSizeLimit": true,
                    "fileSizeLimitBytes": 100000,
                    "path": "C:\\Temp\\pushservice\\logs\\push_service_log-.txt"
                }
            }
        ]
    },
    "Logging": {
        "LogLevel": {
            "Default": "Debug",
            "System": "Warning",
            "Microsoft": "Warning"
        }
    },
    "Authentication": {
        "Authority": "https://mf1.cmiag.ch/stsdevelop/identity",
        "Audience": "push-api"
    },
    "AllowedHosts": "*"
}