blob: 8384a92bbd6a5b24e4b8382304cfb26351cd613f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
from srht.config import cfg
from srht.database import DbSession, db
if not hasattr(db, "session"):
# Initialize the database if not already configured (for running daemon)
db = DbSession(cfg("git.sr.ht", "connection-string"))
import gitsrht.types
db.init()
from srht.webhook import Event
from srht.webhook.celery import CeleryWebhook, make_worker
from scmsrht.webhooks import UserWebhook
import sqlalchemy as sa
worker = make_worker(broker=cfg("git.sr.ht", "webhooks"))
class RepoWebhook(CeleryWebhook):
events = [
Event("repo:post-update", "data:read"),
]
sync = sa.Column(sa.Boolean, nullable=False, server_default="f")
"""
If true, this webhook will be run syncronously during a git push, and
the response text printed to the console of the pushing user.
"""
repo_id = sa.Column(sa.Integer,
sa.ForeignKey('repository.id'), nullable=False)
repo = sa.orm.relationship('Repository')
|