-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(webhooks): allow client registration through env #118
feat(webhooks): allow client registration through env #118
Conversation
Signed-off-by: david <david@umaproject.org>
// assert( | ||
// isDomainValid, | ||
// "The base URL of the provided webhook does not match any of the client domains", | ||
// ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed domain checking for now
@@ -2,6 +2,7 @@ import { Entity, Column, PrimaryGeneratedColumn, Unique } from "typeorm"; | |||
|
|||
@Entity() | |||
@Unique("UK_webhook_client_api_key", ["apiKey"]) | |||
@Unique("UK_webhook_client_name", ["name"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i wnated to make a unique constraint for name, i dont know if i did this right because i have no idea what UK_webhook means
@@ -0,0 +1,17 @@ | |||
import { MigrationInterface, QueryRunner } from "typeorm"; | |||
|
|||
export class Webhook1732730161339 implements MigrationInterface { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did the migration after adding uniquye name constraint, again dont know if this is correct
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe I'm a bit confused on this but shouldn't CB be able to register their own client hooks?
@@ -87,10 +87,12 @@ export async function Main( | |||
const postgres = await connectToDatabase(postgresConfig, logger); | |||
const redisConfig = Indexer.parseRedisConfig(env); | |||
const redis = await initializeRedis(redisConfig, logger); | |||
const webhooks = Webhooks.WebhookFactory( | |||
const webhooks = await Webhooks.WebhookFactory( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Usually a factory is a class that has a builder function on it. Is this Factory a function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as long as this runs the code looks fine outside of stylizations
motivation
we need an easy way to add and update arbitrary webhook clients
changes
this adds env config var to regsiter new clients as well as removes domain checks to make it easier for testing