A Webhook Handler for Github, Gitlab, .... It's just a simple parser and you should extend this project if you need a visualization.
You need to set env variables for using webhooks. Create a .env
like this :
SECRET=changeme
DB_CONNECTION="mongodb://localhost:27017/webhook"
PROVIDER=github
# Github: X-Hub-Signature
# Gitlab: X-Gitlab-Token
# Gogs: X-Gogs-Signature
# Gitea: HTTP_X_GITEA_SIGNATURE
SIGNATURE="X-Hub-Signature"
LOG_LEVEL=info
TRUST_KEY=changeme
Use SECRET
value in github settings :
Important : You should select application/json
for content type.
For use with trusted platforms or offline/local usage, you can pass a trusted
query to webhook URL. For example :
http://<domain>/gitlab?trusted=1234
Now, the program will ignore verification and catch anything received.
❕ This query value should equal to TRUST_KEY
variable from your env.
file.
npm install
node hook.js
Or use docker
docker pull hatamiarash7/webhook
docker run -d
-p 3000:3000
-e SECRET='changeme'
-e DB_CONNECTION='mongodb://localhost:27017/webhook'
-e PROVIDER='github'
-e SIGNATURE='X-Hub-Signature'
-e LOG_LEVEL='debug'
-e TRUST_KEY='changeme'
hatamiarash7/webhook
We have 6 level for logging
- trace
- debug
- info
- warn
- error
- fatal
Set any level in .env
file :
LOG_LEVEL=info
- Connect to DB
- Test with git platforms
- Github
- Gitlab
- Gitea
- Gogs
- Configure a logger
- Add another crypto methods
- Add a simple dashboard
Don't be shy to be a contributor 😉
- Fork it !
- Create your feature branch :
git checkout -b my-new-feature
- Commit your changes :
git commit -am 'Add some feature'
- Push to the branch :
git push origin my-new-feature
- Submit a pull request
Each project may have many problems. Contributing to the better development of this project by reporting them.