···11-i cba rn
11+## Snot
22+33+Snot is a tangled knot that shims public repos that you own on forgejo.
44+55+This is very much a hack. So feel free to use or not to use this. At your own respective risk.
66+77+### Setup
88+99+#### Config
1010+1111+At this point basically every option is required to be set. All options also
1212+exist as env vars with the prefix `SNOT`. This may look like `SNOT_WEBHOOK_SECRET`.
1313+1414+```toml
1515+hostname = "knot.example.com"
1616+listen_addr = "0.0.0.0:5555"
1717+owner_did = "did:plc:abc123"
1818+db_dsn = "postgres:///forgejo"
1919+repo_root = "/var/lib/forgejo/repositories"
2020+push_remote = "git@git.example.com"
2121+state_dir = "/var/lib/snot"
2222+plc_url = "https://plc.directory"
2323+webhook_secret = "..."
2424+2525+[users]
2626+"did:plc:abc123" = "isabel"
2727+```
2828+2929+In order to get tangled to receive your push events, you will need to setup a
3030+forgejo system level webhook.
3131+3232+In Forgejo: Site Administration -> Integrations -> Webhooks -> add a **system webhook**
3333+ - Target URL: `https://<knot-host>/hooks/forgejo`
3434+ - HTTP method: `POST`
3535+ - Post content type: `application/json`
3636+ - Secret: the same `webhook_secret`, likely generated via `openssl rand --hex 32`
3737+ - Trigger: Push events
3838+3939+If using postgres like me (which is the only tested option right now) you will
4040+need to setup a `snot` user and give it access to the forgejo data. For me that
4141+looked like the following:
4242+4343+```sql
4444+GRANT CONNECT ON DATABASE forgejo TO "snot";
4545+ALTER DEFAULT PRIVILEGES FOR ROLE forgejo GRANT SELECT ON TABLES TO "snot";
4646+GRANT SELECT ON ALL TABLES IN SCHEMA public TO "snot";
4747+```
4848+4949+#### Registering the Knot
5050+5151+Its same as the tangled knot.
5252+5353+#### Creating a repo.
5454+5555+1. Create a repo on the forgejo frontend however you like and give it a name.
5656+2. On the tangled frontend create a repo on your snot, with the same name as
5757+ the repo you just made.
5858+3. Thats all!
5959+6060+#### Pushing
6161+6262+You push to whatever you have your forgejo setup to push to, I assume there on
6363+the same server anyways.