RelayConfiguration

Configuration

Relay can be configured using environment variables, or any approach supported by ASP.NET Core

Your desired approach may differ depending on the environment you’re configuring, e.g.:

If you’re running Relay as part of a composed stack of containers, we recommend setting environment variables in the compose.yml.

For example:

compose.yml
services:
  # ...
 
  relay:
    # ...
 
    environment:
      ConnectionStrings__Default: Server=db_host;Port=5432;Database=hutch-relay;User Id=postgres;Password=postgres
      RelayTaskQueue__ConnectionString: amqp://user:password@rabbitmq:5672
 
      UpstreamTaskApi__BaseUrl: https://my-task-api.com
      UpstreamTaskApi__CollectionId: dd52026b-5a61-4c89-b733-04ba141b3f31
      UpstreamTaskApi__Username: user
      UpstreamTaskApi__Password: password
 
    # ...

Upstream Task API

Configuration Section: UptreamTaskApi

KeyDescription
BaseUrl*

The Base URL for an Upstream Task API that Relay should fetch jobs from. This only needs to include scheme (e.g. https://), host (my-task-api.com) and optionally port 8080

CollectionId*An ID (provided from the Upstream API) for this Task API consumer
Username*A valid username for accessing the Task API
Password*A valid password for the Task API user configured above
PollingFrequency

Interval in milliseconds between polling requests to the Upstream Task API.

Defaults to 5000 (5 seconds).

Examples:

.env
UpstreamTaskApi__BaseUrl="https://my-task-api.com"
UpstreamTaskApi__CollectionId="dd52026b-5a61-4c89-b733-04ba141b3f31"
UpstreamTaskApi__Username=user
UpstreamTaskApi__Password=password
UpstreamTaskApi__PollingFrequency=5000

Database Connections

Configuration Section: ConnectionStrings

KeyDescription
Default*

An ODBC/ADO.NET style connection string for a PostgreSQL 16 Server, and a database name for Relay to store working state in.

Configuration Section: Database

KeyDescription
ApplyMigrationsOnStartup

Should Relay automatically apply outstanding database migrations at startup? true / false.

Defaults to false.

Examples:

.env
ConnectionStrings__Default="Server=localhost;Port=5432;Database=hutch-relay;User Id=postgres;Password=postgres"
Database__ApplyMigrationsOnStartup=true

RelayTask Queue

Configuration Section: RelayTaskQueue

KeyDescription
ConnectionString*A connection URL for an AMQP Server

Examples:

.env
RelayTaskQueue__ConnectionString="amqp://user:password@localhost:5672"

Results Obfuscation

Configuration Section: Obfuscation

KeyDescription
LowNumberSuppressionThreshold

A positive number will set the threshold below which Relay will suppress and return 0.

Defaults to 0 (effectively off).

RoundingTarget

The target nearest number to round up to, e.g. 10 will round both 171 and 179 to 180.

Defaults to 0 (effectively off).

Examples:

.env
Obfuscation__LowNumberSuppressionThreshold=50
Obfuscation__RoundingTarget=5

ASP.NET Core

Since Relay is an ASP.NET Core application, there are some capabilities of that framework that can be configured in the standard way.

Examples of this include logging levels and hosting configuration (e.g. bind addresses, TLS…).

Please refer to the ASP.NET Core documentation on these topics.