Skip to content

Commit 03a3a05

Browse files
authored
docs: add matrix config readme (#40)
1 parent 231717b commit 03a3a05

1 file changed

Lines changed: 72 additions & 18 deletions

File tree

README.md

Lines changed: 72 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -33,23 +33,36 @@ This produces the `bolte-bridge` executable in the current directory.
3333
Run the built executable:
3434

3535
```bash
36-
BOLTE_BRIDGE_EMAIL_PASSWORD=<app-password> ./bolte-bridge --email bridge@example.com
36+
BOLTE_BRIDGE_EMAIL_PASSWORD=<app-password> \
37+
BOLTE_BRIDGE_MATRIX_AS_TOKEN=<as-token> \
38+
BOLTE_BRIDGE_MATRIX_HS_TOKEN=<hs-token> \
39+
./bolte-bridge \
40+
--email bridge@example.com \
41+
--matrix-homeserver-url https://matrix.org \
42+
--matrix-server-name matrix.org \
43+
--matrix-appservice-id my-bridge \
44+
--matrix-sender-localpart bridge-bot \
45+
--matrix-room-id '!room:matrix.org'
3746
```
3847

3948
Alternatively, run the bridge directly with Go:
4049

4150
```bash
42-
BOLTE_BRIDGE_EMAIL_PASSWORD=<app-password> go run . --email bridge@example.com
51+
BOLTE_BRIDGE_EMAIL_PASSWORD=<app-password> \
52+
BOLTE_BRIDGE_MATRIX_AS_TOKEN=<as-token> \
53+
BOLTE_BRIDGE_MATRIX_HS_TOKEN=<hs-token> \
54+
go run . \
55+
--email bridge@example.com \
56+
--matrix-homeserver-url https://matrix.org \
57+
--matrix-server-name matrix.org \
58+
--matrix-appservice-id my-bridge \
59+
--matrix-sender-localpart bridge-bot \
60+
--matrix-room-id '!room:matrix.org'
4361
```
4462

45-
The bridge signs in to a single mail account, which it uses to read from and
46-
post to the mailing list. The account address and password are **required**;
47-
the bridge exits at startup if either is missing. Everything else has a
48-
default.
63+
The bridge signs in to a single mail account and connects to a Matrix homeserver, which it uses to bridge messages between the mailing list and a Matrix room. The mail account address, password, and Matrix appservice tokens are **required**; the bridge exits at startup if any of these are missing. Everything else has a default.
4964

50-
By default, the bridge creates and uses a SQLite database named
51-
`bolte-bridge.db` in the current working directory, and talks to Gmail's
52-
IMAP and SMTP endpoints.
65+
By default, the bridge creates and uses a SQLite database named `bolte-bridge.db` in the current working directory, and talks to Gmail's IMAP and SMTP endpoints, alongside the Matrix Client-Server API.
5366

5467
### Configuration
5568

@@ -70,8 +83,13 @@ be visible in the process table and in shell history.
7083
| `-d`, `--db-path` | Path to the SQLite database. | `bolte-bridge.db` |
7184
| `-e`, `--email` | Account name for IMAP/SMTP (the full email address). **Required.** ||
7285
| `--email-imap-addr` | `host:port` of the IMAP endpoint (implicit TLS). | `imap.gmail.com:993` |
73-
| `--email-smtp-addr` | `host:port` of the SMTP submission endpoint (STARTTLS). | `smtp.gmail.com:587` |
7486
| `--email-mailbox` | IMAP mailbox to fetch from. | `INBOX` |
87+
| `--email-smtp-addr` | `host:port` of the SMTP submission endpoint (STARTTLS). | `smtp.gmail.com:587` |
88+
| `--matrix-appservice-id` | Appservice registration ID. **Required.** ||
89+
| `--matrix-homeserver-url` | Base URL of the homeserver Client-Server API (e.g. `https://matrix.org`). **Required.** ||
90+
| `--matrix-room-id` | The Matrix room to bridge (`!room:server`). **Required.** ||
91+
| `--matrix-sender-localpart` | Appservice bot user localpart. **Required.** ||
92+
| `--matrix-server-name` | Homeserver server_name (e.g. `matrix.org`). **Required.** ||
7593

7694
### Environment variables
7795

@@ -82,14 +100,19 @@ Every setting is also readable from the environment, under the
82100
| ---- | ----------- | ------- |
83101
| `BOLTE_BRIDGE_DB_PATH` | Path to the SQLite database. | `bolte-bridge.db` |
84102
| `BOLTE_BRIDGE_EMAIL_ACCOUNT` | Account name for IMAP/SMTP (the full email address). **Required.** ||
85-
| `BOLTE_BRIDGE_EMAIL_PASSWORD` | Account password. **Required**, and settable only here. ||
86103
| `BOLTE_BRIDGE_EMAIL_IMAP_ADDR` | `host:port` of the IMAP endpoint (implicit TLS). | `imap.gmail.com:993` |
87-
| `BOLTE_BRIDGE_EMAIL_SMTP_ADDR` | `host:port` of the SMTP submission endpoint (STARTTLS). | `smtp.gmail.com:587` |
88104
| `BOLTE_BRIDGE_EMAIL_MAILBOX` | IMAP mailbox to fetch from. | `INBOX` |
105+
| `BOLTE_BRIDGE_EMAIL_PASSWORD` | Account password. **Required**, and settable only here. ||
106+
| `BOLTE_BRIDGE_EMAIL_SMTP_ADDR` | `host:port` of the SMTP submission endpoint (STARTTLS). | `smtp.gmail.com:587` |
107+
| `BOLTE_BRIDGE_MATRIX_APPSERVICE_ID` | Appservice registration ID. **Required.** ||
108+
| `BOLTE_BRIDGE_MATRIX_AS_TOKEN` | Appservice token (`as_token`). **Required**, settable only here. ||
109+
| `BOLTE_BRIDGE_MATRIX_HOMESERVER_URL` | Base URL of the homeserver Client-Server API. **Required.** ||
110+
| `BOLTE_BRIDGE_MATRIX_HS_TOKEN` | Homeserver token (`hs_token`). **Required**, settable only here. ||
111+
| `BOLTE_BRIDGE_MATRIX_ROOM_ID` | The Matrix room to bridge (`!room:server`). **Required.** ||
112+
| `BOLTE_BRIDGE_MATRIX_SENDER_LOCALPART` | Appservice bot user localpart. **Required.** ||
113+
| `BOLTE_BRIDGE_MATRIX_SERVER_NAME` | Homeserver `server_name`. **Required.** ||
89114

90-
The IMAP endpoint is contacted over implicit TLS and the SMTP endpoint over
91-
STARTTLS, so the port you choose should be one the server offers for that
92-
scheme.
115+
The IMAP endpoint is contacted over implicit TLS and the SMTP endpoint over STARTTLS, so the port you choose should be one the server offers for that scheme.
93116

94117
If you point the bridge at a Gmail account, the password is an
95118
[app password](https://support.google.com/accounts/answer/185833), not the
@@ -103,26 +126,50 @@ Run against Gmail with the default endpoints and database:
103126

104127
```bash
105128
export BOLTE_BRIDGE_EMAIL_PASSWORD=<app-password>
106-
go run . --email bridge@example.com
129+
export BOLTE_BRIDGE_MATRIX_AS_TOKEN=<as-token>
130+
export BOLTE_BRIDGE_MATRIX_HS_TOKEN=<hs-token>
131+
go run . \
132+
--email bridge@example.com \
133+
--matrix-homeserver-url https://matrix.org \
134+
--matrix-server-name matrix.org \
135+
--matrix-appservice-id my-bridge \
136+
--matrix-sender-localpart bridge-bot \
137+
--matrix-room-id "!room:matrix.org"
107138
```
108139

109140
Use a custom database path:
110141

111142
```bash
112143
export BOLTE_BRIDGE_EMAIL_PASSWORD=<app-password>
113-
go run . --email bridge@example.com --db-path bridge.db
144+
export BOLTE_BRIDGE_MATRIX_AS_TOKEN=<as-token>
145+
export BOLTE_BRIDGE_MATRIX_HS_TOKEN=<hs-token>
146+
go run . \
147+
--email bridge@example.com \
148+
--db-path bridge.db \
149+
--matrix-homeserver-url https://matrix.org \
150+
--matrix-server-name matrix.org \
151+
--matrix-appservice-id my-bridge \
152+
--matrix-sender-localpart bridge-bot \
153+
--matrix-room-id "!room:matrix.org"
114154
```
115155

116156
Point the bridge at a non-Gmail provider, and read from a mailbox other than
117157
`INBOX`:
118158

119159
```bash
120160
export BOLTE_BRIDGE_EMAIL_PASSWORD=<app-password>
161+
export BOLTE_BRIDGE_MATRIX_AS_TOKEN=<as-token>
162+
export BOLTE_BRIDGE_MATRIX_HS_TOKEN=<hs-token>
121163
go run . \
122164
--email bridge@example.com \
123165
--email-imap-addr imap.example.com:993 \
124166
--email-smtp-addr smtp.example.com:587 \
125-
--email-mailbox Lists/mlug
167+
--email-mailbox Lists/mlug \
168+
--matrix-homeserver-url https://matrix.org \
169+
--matrix-server-name matrix.org \
170+
--matrix-appservice-id my-bridge \
171+
--matrix-sender-localpart bridge-bot \
172+
--matrix-room-id "!room:matrix.org"
126173
```
127174

128175
Or configure everything through the environment:
@@ -134,5 +181,12 @@ export BOLTE_BRIDGE_EMAIL_PASSWORD=<app-password>
134181
export BOLTE_BRIDGE_EMAIL_IMAP_ADDR=imap.example.com:993
135182
export BOLTE_BRIDGE_EMAIL_SMTP_ADDR=smtp.example.com:587
136183
export BOLTE_BRIDGE_EMAIL_MAILBOX=Lists/mlug
184+
export BOLTE_BRIDGE_MATRIX_HOMESERVER_URL=https://matrix.org
185+
export BOLTE_BRIDGE_MATRIX_SERVER_NAME=matrix.org
186+
export BOLTE_BRIDGE_MATRIX_APPSERVICE_ID=my-bridge
187+
export BOLTE_BRIDGE_MATRIX_AS_TOKEN=<as-token>
188+
export BOLTE_BRIDGE_MATRIX_HS_TOKEN=<hs-token>
189+
export BOLTE_BRIDGE_MATRIX_SENDER_LOCALPART=bridge-bot
190+
export BOLTE_BRIDGE_MATRIX_ROOM_ID="!room:matrix.org"
137191
go run .
138192
```

0 commit comments

Comments
 (0)