Docs menu

Configuration

dotwire reads standard .NET configuration. As environment variables, replace each : with __, so Dotwire:Sse:Enabled becomes Dotwire__Sse__Enabled. For local runs with dotnet run, dotwire also loads a .env file.

Options without a default must be set. dotwire refuses to start if a required option is missing or invalid.

Connection strings

KeyDescription
ConnectionStrings:PostgresMigratorOwner role (dotwire). Used to run migrations and apply startup retention.
ConnectionStrings:PostgresWriteRuntime role (dotwire_app) for writes.
ConnectionStrings:PostgresReadRuntime role for reads, including authorization checks and history. Can point at a replica.

Postgres

KeyDefaultDescription
Postgres:MigratetrueRun the embedded migrations at startup. Set it on one node only.
Postgres:AppRolePassword—Password that the migration run sets for the dotwire_app role.

Auth

See Auth. Set Auth:Keys, Auth:JwksUrl, or both.

KeyDefaultDescription
Auth:IssuerRequiredExpected iss claim.
Auth:AudienceRequiredExpected aud claim.
Auth:Keys:<kid>—PEM-encoded RSA public key for key id <kid>. Repeat for each key.
Auth:JwksUrl—JWKS endpoint to fetch public keys from.
Auth:JwksRefreshMinutes5JWKS cache refresh interval.

Node

KeyDefaultDescription
Dotwire:RoleAllAll, Api, or Gateway. See Node roles.
Dotwire:MaxContentBytes65536Maximum message content size in UTF-8 bytes.

Encryption

See Encryption and retention.

KeyDefaultDescription
Dotwire:Encryption:ActiveKeyIdRequiredKey id new messages are encrypted under. Must name a configured key.
Dotwire:Encryption:Keys:<id>RequiredBase64-encoded 32-byte AES key. Keep old ids configured after rotation.

Retention

KeyDefaultDescription
Dotwire:Retention:MessagesDaysUnsetPostgres history retention in days, applied at startup by the node that runs migrations. Unset leaves the value last set through the admin API. Manage retention here or through the API, not both.

JetStream retention is Nats:RoomsMaxAgeHours, below.

Webhooks

See Moderation webhooks.

KeyDefaultDescription
Dotwire:Webhooks:SecretUnsetWhen set, both call-outs carry X-Dotwire-Signature: sha256=<hex>.
Dotwire:Webhooks:Presend:UrlUnsetPresend call-out URL. Presend is off when unset.
Dotwire:Webhooks:Presend:TimeoutMs500How long dotwire waits for an answer.
Dotwire:Webhooks:Presend:FailPolicyClosedClosed fails the send with 503 presend_unavailable. Open accepts the original content.
Dotwire:Webhooks:Presend:IncludeAdminSendsfalseAlso run presend for admin message injection.
Dotwire:Webhooks:PostSend:UrlUnsetPostsend call-out URL. Postsend is off when unset.
Dotwire:Webhooks:PostSend:TimeoutMs2000Timeout per delivery attempt.
Dotwire:Webhooks:PostSend:MaxAttempts3Delivery attempts per message.
Dotwire:Webhooks:PostSend:QueueCapacity10000Queue size. When full, the newest item is dropped with a warning.
Dotwire:Webhooks:PostSend:IncludeAdminSendsfalseAlso run postsend for admin message injection.

SSE

See Stream room events.

KeyDefaultDescription
Dotwire:Sse:EnabledtrueWhen false, the events endpoint returns 404.
Dotwire:Sse:KeepAliveSeconds15Interval between keep-alive comments.
Dotwire:Sse:BufferSize256Events buffered per connection. A connection that falls further behind is closed.
Dotwire:Sse:ReplayPageSize100Rows per page when replaying history on resume.

Rate limits

See Rate limits. Each bucket has three settings: PermitLimit (bucket size), TokensPerPeriod (tokens added each period), and PeriodSeconds.

BucketKeyed byCoversPermitLimitTokensPerPeriodPeriodSeconds
Dotwire:RateLimits:SendUserMember message sends2051
Dotwire:RateLimits:ReadUserHistory, participants, SSE connects, /audit30101
Dotwire:RateLimits:AdminUserEvery /admin route200501
Dotwire:RateLimits:HubConnectionHub Subscribe and Unsubscribe30101

Dotwire:RateLimits:Enabled (default true) turns all buckets on or off. For example, Dotwire__RateLimits__Send__PermitLimit=40 doubles the send bucket.

NATS

KeyDefaultDescription
Nats:Urlnats://localhost:4222NATS server URL. Separate several URLs with commas. For an authenticated server, include the credentials: nats://<user>:<password>@host:4222. See Securing NATS.
Nats:EnabledtrueProvision streams and run the NATS consumers at startup.
Nats:RoomsStreamROOMSJetStream stream for room messages.
Nats:RoomSubjectPrefixroom.Prefix of each room's subject, room.{roomId}.
Nats:RoomsSubjectFilterroom.*Subject filter of the rooms stream. Don't widen it to room.>; see Ephemeral traffic.
Nats:RoomLiveSubjectSuffix.liveSuffix of the core subject used for live fanout.
Nats:RoomsMaxAgeHours48How long the rooms stream keeps messages.
Nats:BatchMaxMessages500Postgres writer: maximum messages per batch.
Nats:BatchLingerMs1000Postgres writer: wait before flushing a partial batch.
Nats:PostgresWriterConsumerpostgres-writerDurable consumer name for the Postgres writer.
Nats:AuditStreamAUDITJetStream stream for audit events.
Nats:AuditSubjectaudit.eventsSubject for audit events.
Nats:AuditWriterConsumeraudit-writerDurable consumer name for the audit writer.
Nats:AuditWriter:BatchMaxMessages200Audit writer: maximum events per fetch.
Nats:AuditWriter:BatchLingerMs1000Audit writer: wait before flushing a partial batch.
Nats:AuditWriter:StandbyRetrySeconds5How often a standby node retries for the audit writer lock.

Runtime

compose.yaml sets these .NET runtime variables, which suit connection-dense workloads:

VariableValueEffect
DOTNET_gcServer1Server garbage collector.
DOTNET_GCDynamicAdaptationMode1Dynamic adaptation of the server GC (DATAS).