config.py 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. # @File : config.py
  4. # @Author: becivells
  5. #@Contact : becivells@gmail.com
  6. # @Date : 2017/10/19
  7. #@Software : PyCharm
  8. # @Desc :
  9. import os
  10. basedir = os.path.abspath(os.path.dirname(__file__))
  11. dbdir = basedir + os.sep + 'db'
  12. HOST = '0.0.0.0'
  13. PORT = 21332
  14. DEBUG = False #True or False
  15. #允许git server地址访问
  16. GIT_SERVER = [
  17. #localhost
  18. '127.0.0.1',
  19. '123.206.177.125',
  20. '123.206.116.149'
  21. ]
  22. #访问的路径
  23. SYNC_PATH = 'hookssync'
  24. #允许执行命令时的路径
  25. PATH_WHITE_LIST = [
  26. # 匹配所有
  27. '.*',
  28. # /app/web/test
  29. '^/app/web/.*',
  30. # /app/web/tests
  31. '^/var/www/html/.*',
  32. '/www/wwwroot/.*'
  33. ]
  34. SECRET_KEY = os.environ.get('SECRET_KEY') or 'you-will-never-guess@qwea31ws'
  35. #允许在webhooks执行时执行的命令 使用正则表达式进行匹配
  36. EXEC_WHITE_LIST = [
  37. # 匹配所有
  38. '.*',
  39. # git pull origin master
  40. '^git pull \w+ \w+$',
  41. # git fetch origin master && git reset --hard origin/master
  42. '^git fetch \w+ \w+ && git reset --hard \w+/\w+$',
  43. # git pull origin master && supervisorctl restart webhooks
  44. '^git pull \w+ \w+ && supervisorctl restart \w+$',
  45. # git fetch origin master && git reset --hard origin/master && supervisorctl restart webhooks
  46. '^git fetch \w+ \w+ && git reset --hard \w+/\w+ && supervisorctl restart \w+$'
  47. ]
  48. repo = {
  49. "9901b6deb47111e7b832704d7b885ead":{
  50. "name":"hneccp",
  51. "path":"/app/web/www.hneccp.com/",
  52. "ip":['127.0.0.1','123.206.177.125'],
  53. "cmd":'git pull origin master',
  54. "user":'apache',
  55. 'interval':10
  56. },
  57. }
  58. # repo = {
  59. # "9901b6deb47111e7b832704d7b885ead":{
  60. # "name":"fanghuishop",
  61. # "path":"/app/web/fanghuishop",
  62. # "ip":['127.0.0.1','123.206.177.125'],
  63. # "cmd":'git fetch origin master && git reset --hard origin/master',
  64. # "user":'apache',
  65. # 'interval':3
  66. # }
  67. # }