summaryrefslogtreecommitdiff
path: root/fedishoop/federation.ts
blob: e703ffdeab8b2365f922c4aba759633eccefc0c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import { createFederation, Person } from "@fedify/fedify";
import { getLogger } from "@logtape/logtape";
import { RedisKvStore, RedisMessageQueue } from "@fedify/redis";
import { Redis } from "ioredis";

const logger = getLogger("fedishoop");

const federation = createFederation({
  kv: new RedisKvStore(new Redis(Deno.env.get("REDIS_URL"))),
  queue: new RedisMessageQueue(() => new Redis(Deno.env.get("REDIS_URL"))),
});

federation.setActorDispatcher("/users/{identifier}", async (ctx, identifier) => {
  return new Person({
    id: ctx.getActorUri(identifier),
    preferredUsername: identifier,
    name: identifier,
  });
});

export default federation;