Webhook Executor
This lightweight project facilitates the handling of webhook requests by executing an appropriate command for each webhook. It operates based on configurations provided in the hooks.json
file.
In the hooks.json
file, define hooks with the following structure:
[
{
"id": "hook_id",
"commandPath": "/var/www/apps/project/script/deploy.sh",
"workingDirectory": "/var/www/apps/project"
}
]
Hooks are verified at launch time, and only valid ones (with existing id
, commandPath
, and workingDirectory
) are loaded.
Customize the behavior of the project by setting the following environment variables:
PORT=5555 # Specify the port for the webhook server.
MAX_REQUEST_PER_WINDOWS=1 # Set the maximum number of requests allowed in a defined time window.
WINDOWS_SIZE_IN_MS=120000 # Define the size of the time window in milliseconds (2 * 60 * 1000).
- Clone the repository: git clone https://github.com/paulpascal/webhook_executor.git
- Install dependencies: npm install
- Set up the
hooks.json
file with your webhook configurations. - Customize environment variables if needed.
- Start the server:
npm start
Contributions are welcome! Follow these steps:
- Fork the project.
- Create a new branch:
git checkout -b feature/your-feature
- Commit your changes:
git commit -m 'Add your feature'
- Push to the branch:
git push origin feature/your-feature
- Submit a pull request.
This project is licensed under the Apache License.