Configuration

August 21, 2023 ยท View on GitHub

Informatics Gateway Configuration File

The configuration file (appsettings.json) controls the behaviors and parameters of the internal services. The file is stored next to the main application binary and provides a subset of the default configuration options by default. Please refer to the Monai.Deploy.InformaticsGateway.Configuration namespace for complete reference.

Configuration Sections

appsettings.json contains the following top-level sections:

{
    "ConnectionStrings": "connection string to the database",
    "InformaticsGateway": "configuration options for the Informatics Gateway & its internal services",
    "Logging": "logging configuration options",
    "Kestrel": "web server configuration options. See https://docs.microsoft.com/en-us/aspnet/core/fundamentals/servers/kestrel?view=aspnetcore-5.0",
    "AllowedHosts": "host filtering option.  See https://docs.microsoft.com/en-us/aspnet/core/fundamentals/servers/kestrel/host-filtering?view=aspnetcore-5.0",
    "Cli": "configurations used by the CLI"
}

The InformaticsGateway configuration section contains the following sub-sections:

SectionDescriptionReference
dicomDICOM DIMSE service configuration optionsDicomConfiguration
dicomWebDICOMweb service configuration optionsDicomWebConfiguration
exportExport service configuration optionsDataExportConfiguration
fhirFHIR service configuration optionsFhirConfiguration
hl7HL7 listener configuration optionsHl7Configuration
storageStorage configuration options, including storage service and disk usage monitoringStorageConfiguration
messagingMessage broker configuration optionsMessageBrokerConfiguration
plug-insConfiguration options for plug-insPlugInConfiguration
CliThe configuration used by the CLI-

Default Configuration

{
    "ConnectionStrings": {
        "InformaticsGatewayDatabase": "Data Source=/database/mig.db"
    },
    "InformaticsGateway": {
        "dicom": {
            "scp": {
                "port": 104,
                "logDimseDatasets": false,
                "rejectUnknownSources": true
            },
            "scu": {
                "aeTitle": "MONAISCU",
                "logDimseDatasets": false,
                "logDataPDUs": false
            }
        },
        "messaging": {
            "publisherServiceAssemblyName": "Monai.Deploy.Messaging.RabbitMQ.RabbitMQMessagePublisherService, Monai.Deploy.Messaging.RabbitMQ",
            "publisherSettings": {
                "endpoint": "localhost",
                "username": "username",
                "password": "password",
                "virtualHost": "monaideploy",
                "exchange": "monaideploy"
            },
            "subscriberServiceAssemblyName": "Monai.Deploy.Messaging.RabbitMQ.RabbitMQMessageSubscriberService, Monai.Deploy.Messaging.RabbitMQ",
            "subscriberSettings": {
                "endpoint": "localhost",
                "username": "username",
                "password": "password",
                "virtualHost": "monaideploy",
                "exchange": "monaideploy",
                "exportRequestQueue": "export_tasks",
                "deadLetterExchange": "monaideploy-dead-letter",
                "deliveryLimit": 3,
                "requeueDelay": 30
            }
        },
        "storage": {
            "localTemporaryStoragePath": "/payloads",
            "remoteTemporaryStoragePath": "/incoming",
            "bucketName": "monaideploy",
            "storageRootPath": "/payloads",
            "temporaryBucketName": "monaideploy",
            "serviceAssemblyName": "Monai.Deploy.Storage.MinIO.MinIoStorageService, Monai.Deploy.Storage.MinIO",
            "watermarkPercent": 75,
            "reserveSpaceGB": 5,
            "settings": {
                "endpoint": "localhost:9000",
                "accessKey": "admin",
                "accessToken": "password",
                "securedConnection": false,
                "region": "local",
                "executableLocation": "/bin/mc",
                "serviceName": "MinIO"
            }
        },
        "hl7": {
            "port": 2575,
            "maximumNumberOfConnections": 10,
            "clientTimeout": 60000,
            "sendAck": true
        },
      "dicomWeb": {
        "plugins": []
      },
    },
    "Kestrel": {
        "EndPoints": {
            "Http": {
                "Url": "http://+:5000"
            }
        }
    },
    "AllowedHosts": "*",
    "Cli": {
        "Runner": "Docker",
        "HostDataStorageMount": "~/.mig/data",
        "HostPlugInsStorageMount": "~/.mig/plug-ins",
        "HostDatabaseStorageMount": "~/.mig/database",
        "HostLogsStorageMount": "~/.mig/logs",
        "InformaticsGatewayServerEndpoint": "http://localhost:5000",
        "DockerImagePrefix": "ghcr.io/project-monai/monai-deploy-informatics-gateway"
    }
}

Configuration Validation

Informatics Gateway validates all configuration options at startup. Any provided values that are invalid or missing may cause the service to crash.

Note

If the Informatics Gateway is running with Kubernetes/Helm and is reporting the CrashLoopBack error, it may be indicating a startup error due to misconfiguration, simply run kubectl logs <name-of-dicom-adapter-pod> to review the validation errors.

Logging

Informatics Gateway, by default, is configured to writes all logs to the console as well as text files. The behaviors may be changed in the nlog.config file.

Logs files are stored in the logs/ directory where the Informatics Gateway executable is stored. To change the location, modify the logDir variable defined in the nlog.config file.

Informaitcs Gateway also supports shipping logs to LogStash, ELK using the Network target provided by NLog. To enable this feature, simply set the environment variable LOGSTASH_URL to the TCP endpoint of LogStash. E.g. LOGSTASH_URL=tcp://my-logstash-ip:5000.

To use other logging services, refer to NLog Config.

Note

If the Informatics Gateway is running inside a Docker container, additional configuration may be required to limit the size to prevent logs from filling up storage space. Refer to the Docker documentation for additional information.