Skip to content

Commit

Permalink
add service to forward webhooks to local server using smee
Browse files Browse the repository at this point in the history
Signed-off-by: kaxada <[email protected]>
  • Loading branch information
kaxada committed Mar 21, 2024
1 parent 9d13927 commit 91a2b11
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,25 @@ routes.setupRoutes(app);
console.log(error);
}
})();

/**
* The block of code below is only used in development mode.
* It is used to forward webhooks from GitHub to the local server.
* This is necessary because the local server is not publicly accessible.
* The smee.io service is used to forward the webhooks.
* The smee.io target URL is the local server's URL.
* The smee.io source URL is the GitHub webhook URL.
* The smee.io service is started using the smee.start() method.
*
*/
if (process.env.NODE_ENV === "development") {
const SmeeClient = require("smee-client");

const smee = new SmeeClient({
source: `${process.env.SMEECLIENT_URL}`,
target: `http://localhost:${process.env.PORT}/api/event_badging`,
logger: console,
});

smee.start();
}

0 comments on commit 91a2b11

Please sign in to comment.