mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
Expose the Ditto pubkey to the policy worker
This commit is contained in:
parent
a2e8de6c36
commit
3b5b4cbd6b
2 changed files with 5 additions and 5 deletions
|
|
@ -50,7 +50,7 @@ class PolicyWorker implements NPolicy {
|
|||
await this.worker.init({
|
||||
path: Conf.policy,
|
||||
databaseUrl: Conf.databaseUrl,
|
||||
adminPubkey: Conf.pubkey,
|
||||
pubkey: Conf.pubkey,
|
||||
});
|
||||
|
||||
console.warn(`Using custom policy: ${Conf.policy}`);
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ interface PolicyInit {
|
|||
/** Database URL to connect to. */
|
||||
databaseUrl: string;
|
||||
/** Admin pubkey to use for EventsDB checks. */
|
||||
adminPubkey: string;
|
||||
pubkey: string;
|
||||
}
|
||||
|
||||
export class CustomPolicy implements NPolicy {
|
||||
|
|
@ -29,18 +29,18 @@ export class CustomPolicy implements NPolicy {
|
|||
return this.policy.call(event, signal);
|
||||
}
|
||||
|
||||
async init({ path, databaseUrl, adminPubkey }: PolicyInit): Promise<void> {
|
||||
async init({ path, databaseUrl, pubkey }: PolicyInit): Promise<void> {
|
||||
const Policy = (await import(path)).default;
|
||||
|
||||
const { kysely } = DittoDB.create(databaseUrl, { poolSize: 1 });
|
||||
|
||||
const store = new EventsDB({
|
||||
kysely,
|
||||
pubkey: adminPubkey,
|
||||
pubkey,
|
||||
timeout: 1_000,
|
||||
});
|
||||
|
||||
this.policy = new Policy({ store });
|
||||
this.policy = new Policy({ store, pubkey });
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue