From 506ef8a43c3985067f2b9004fcc601056e172ddd Mon Sep 17 00:00:00 2001 From: CSDUMMI Date: Mon, 7 Oct 2024 14:25:10 +0200 Subject: Create initial dev environ --- fedishoop/federation.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 fedishoop/federation.ts (limited to 'fedishoop/federation.ts') diff --git a/fedishoop/federation.ts b/fedishoop/federation.ts new file mode 100644 index 0000000..e703ffd --- /dev/null +++ b/fedishoop/federation.ts @@ -0,0 +1,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; -- cgit v1.2.3