|
5 年之前 | |
---|---|---|
db | 5 年之前 | |
doc | 5 年之前 | |
install | 5 年之前 | |
.gitignore | 5 年之前 | |
README.md | 5 年之前 | |
config.py | 5 年之前 | |
core.py | 5 年之前 | |
requirements.txt | 5 年之前 | |
webhooks.py | 5 年之前 |
下载 Python安装包要求 Python2.7 以上支持 Python 3.x,安装 Python 打开命令行
pip install flask
C:/programData
目录下C:/windows/system32/
下打开命令行
nssm install webhook
选择 Python.exe 路径选择webhooks 参数选择 webhooks.py
数据库在 db 目录下的data.sql里面数据库配置在 config.py 里面
SQLALCHEMY_DATABASE_SQLITE_URI = "mysql+pymysql://root:password@localhost:3306/webhook?charset=utf8"
nssm start webhooks
测试
curl -s http://localhost:21332/hookssync/38daa500-55a8-11e8-acd6-704d7b885ead
注意事项
如果在除了
PATH_WHITE_LIST = [
# 匹配所有
'.*',
# /app/web/test
'^/app/web/.*',
# /app/web/tests
'^/var/www/html/.*',
'/www/wwwroot/.*'
]
目录同步代码需要修改 config.py 文件
如果在同步过程中需要执行其他命令需要添加规则
#允许在webhooks执行时执行的命令 使用正则表达式进行匹配
EXEC_WHITE_LIST = [
# 匹配所有
'.*',
# git pull origin master
'^git pull \w+ \w+$',
# git fetch origin master && git reset --hard origin/master
'^git fetch \w+ \w+ && git reset --hard \w+/\w+$',
# git pull origin master && supervisorctl restart webhooks
'^git pull \w+ \w+ && supervisorctl restart \w+$',
# git fetch origin master && git reset --hard origin/master && supervisorctl restart webhooks
'^git fetch \w+ \w+ && git reset --hard \w+/\w+ && supervisorctl restart \w+$'
]