Configuration file keys
Every options struct in Patrol carries json, yaml and toml tags, so the same struct loads from any of the three formats and the library itself does no config loading. You decode the file; you pass the struct to the constructor.
The tables below are generated from the library’s exported API, 33 keys across 9 structs. A field whose tag is - is a function or a callback: it never comes from a file and is set in code.
Note that the JSON and the YAML spellings differ. JSON uses snake_case, YAML and TOML use the Go field name. That is the tag as written in the library, not a choice made here.
ProducerOptions
Section titled “ProducerOptions”The batching itself. patrol.NewProducer(opts, flushers...), documented on Producer and batching.
| Field | Go type | JSON | YAML | TOML |
|---|---|---|---|---|
BufferInterval | time.Duration | buffer_interval | BufferInterval | BufferInterval |
MaxBatchSize | int | max_batch_size | MaxBatchSize | MaxBatchSize |
MergeWindow | time.Duration | merge_window | MergeWindow | MergeWindow |
OnError | func(err error) | set in code | set in code | set in code |
ProjectName | string | project_name | ProjectName | ProjectName |
SlackOptions
Section titled “SlackOptions”patrol.NewSlack(opts, clientOpts...). Token and Channels are required. See Slack.
| Field | Go type | JSON | YAML | TOML |
|---|---|---|---|---|
AcceptChannelEvent | func(channel string, e *Event) bool | set in code | set in code | set in code |
Channels | []string | channels | Channels | Channels |
Token | string | token | Token | Token |
DiscordOptions
Section titled “DiscordOptions”patrol.NewDiscord(opts). BotToken and Channels are required. See Discord.
| Field | Go type | JSON | YAML | TOML |
|---|---|---|---|---|
BotToken | string | bot_token | BotToken | BotToken |
Channels | []string | channels | Channels | Channels |
TimeZone | string | time_zone | TimeZone | TimeZone |
TwilioOptions
Section titled “TwilioOptions”patrol.NewTwilio(opts). All four of AccountSID, AuthToken, FromNumber and ToNumber are required. See Twilio.
| Field | Go type | JSON | YAML | TOML |
|---|---|---|---|---|
AccountSID | string | account_sid | AccountSID | AccountSID |
AuthToken | string | auth_token | AuthToken | AuthToken |
FromNumber | string | from_number | FromNumber | FromNumber |
TimeZone | string | time_zone | TimeZone | TimeZone |
ToNumber | string | to_number | ToNumber | ToNumber |
InboxOptions
Section titled “InboxOptions”patrol.NewInbox(opts), the SMTP email flusher. From, To, Host and Port are required. See Email.
| Field | Go type | JSON | YAML | TOML |
|---|---|---|---|---|
From | string | from | From | From |
FromPassword | string | from_password | FromPassword | FromPassword |
Host | string | host | Host | Host |
Port | int | port | Port | Port |
TimeZone | string | time_zone | TimeZone | TimeZone |
To | []string | to | To | To |
SQLOptions
Section titled “SQLOptions”patrol.NewSQL(ctx, opts). Engine is required, and it also decides the placeholder style. See SQL.
| Field | Go type | JSON | YAML | TOML |
|---|---|---|---|---|
DSN | string | dsn | DSN | DSN |
Engine | string | engine | Engine | Engine |
ClientOptions
Section titled “ClientOptions”patrol.NewClient(opts, clientOpts...), which posts batches to a Server. Nothing is validated here: the constructor returns no error. See HTTP client.
| Field | Go type | JSON | YAML | TOML |
|---|---|---|---|---|
BaseURL | string | base_url | BaseURL | BaseURL |
BasicAuth | BasicAuthOptions | basic_auth | BasicAuth | BasicAuth |
Token | string | token | Token | Token |
BasicAuthOptions
Section titled “BasicAuthOptions”The nested struct behind ClientOptions.BasicAuth. In a YAML file it is a block under BasicAuth.
| Field | Go type | JSON | YAML | TOML |
|---|---|---|---|---|
Password | string | password | Password | Password |
Username | string | username | Username | Username |
ServerOptions
Section titled “ServerOptions”patrol.NewServer(opts, flushers...). Nothing is required, which means an unconfigured server accepts every request. See Run your own Server.
| Field | Go type | JSON | YAML | TOML |
|---|---|---|---|---|
BasicAuth | map[string]string | basic_auth | BasicAuth | BasicAuth |
ConsumeTimeout | time.Duration | consume_timeout | ConsumeTimeout | ConsumeTimeout |
OnError | func(err error) | set in code | set in code | set in code |
Tokens | []string | tokens | Tokens | Tokens |
A whole file
Section titled “A whole file”One YAML file per integration is what the library’s own _examples/basic/program does, and it is the shape these keys are built for:
# slack.ymlToken: xoxb-your-bot-tokenChannels: - C0123456789# inbox.ymlFrom: alerts@example.comFromPassword: your_app_passwordTo: - oncall@example.comHost: smtp.example.comPort: 587TimeZone: Europe/AthensDecode each one into its options struct and hand it to its constructor. The library ships no config loader on purpose: your service already has one, and it already knows where your secrets come from.
Where this table comes from
Section titled “Where this table comes from”scripts/gen-config-keys.mjs reads .claude/api-surface.txt in the library’s own repository, which that project’s build regenerates and refuses to let drift from the code. A tag change there shows up as a stale generated file here and fails this site’s build before it can ship a key name that does not exist.