Skip to content

Commit

Permalink
Merge pull request #41 from badging/event-badging-table
Browse files Browse the repository at this point in the history
add service to forward webhooks to local server using smee
  • Loading branch information
kaxada authored Mar 21, 2024
2 parents 9d13927 + 91a2b11 commit 76de8c7
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 76de8c7

Please sign in to comment.