becivells 5 years ago
parent
commit
f8bc22f43f
5 changed files with 0 additions and 141 deletions
  1. 0 9
      config.py
  2. 0 2
      core.py
  3. BIN
      db/app.db
  4. 0 70
      db/data.sql
  5. 0 60
      db/db.py

+ 0 - 9
config.py

@@ -8,8 +8,6 @@
 # @Desc  :
 
 import os
-from sqlalchemy import create_engine
-from sqlalchemy.orm import sessionmaker
 
 basedir = os.path.abspath(os.path.dirname(__file__))
 dbdir = basedir + os.sep + 'db'
@@ -46,13 +44,6 @@ PATH_WHITE_LIST = [
 SECRET_KEY = os.environ.get('SECRET_KEY') or 'you-will-never-guess@qwea31ws'
 
 
-SQLALCHEMY_DATABASE_MYSQL_URI = "mysql+pymysql://root:password@localhost:3306/webhook?charset=utf8"
-SQLALCHEMY_DATABASE_SQLITE_URI = os.environ.get('DATABASE_URL') or \
-        'sqlite:///' + os.path.join(dbdir, 'app.db')
-SQLALCHEMY_TRACK_MODIFICATIONS = False
-engine = create_engine(SQLALCHEMY_DATABASE_MYSQL_URI)
-session_class = sessionmaker(bind=engine)
-
 #允许在webhooks执行时执行的命令 使用正则表达式进行匹配
 EXEC_WHITE_LIST = [
      # 匹配所有

+ 0 - 2
core.py

@@ -14,7 +14,6 @@ from config import repo
 from config import EXEC_WHITE_LIST
 from config import PATH_WHITE_LIST
 from conf.confapi import getconf
-from db.db import get_dbconf
 def runcmd(cmd,path):
     out_temp = tempfile.SpooledTemporaryFile(max_size=10 * 1000)
     try:
@@ -69,5 +68,4 @@ def getrepo():
     :return:
     '''
     repo.update(getconf())
-    repo.update(get_dbconf())
     return repo

BIN
db/app.db


+ 0 - 70
db/data.sql

@@ -1,70 +0,0 @@
--- --------------------------------------------------------
--- 主机:                           localhost
--- 服务器版本:                        10.3.8-MariaDB - mariadb.org binary distribution
--- 服务器操作系统:                      Win64
--- HeidiSQL 版本:                  9.5.0.5196
--- --------------------------------------------------------
-
-/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
-/*!40101 SET NAMES utf8 */;
-/*!50503 SET NAMES utf8mb4 */;
-/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
-/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
-
--- 导出  表 webhook.data 结构
-CREATE TABLE IF NOT EXISTS `data` (
-  `id` varchar(40) NOT NULL,
-  `name` varchar(30) DEFAULT NULL,
-  `path` varchar(100) DEFAULT NULL,
-  `ip` varchar(200) DEFAULT NULL,
-  `cmd` varchar(100) DEFAULT NULL,
-  `user` varchar(30) DEFAULT NULL,
-  `interval` varchar(30) DEFAULT NULL,
-  PRIMARY KEY (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-
--- 正在导出表  webhook.data 的数据:~0 rows (大约)
-/*!40000 ALTER TABLE `data` DISABLE KEYS */;
-INSERT INTO `data` (`id`, `name`, `path`, `ip`, `cmd`, `user`, `interval`) VALUES
-	('09118e1c-bff0-11e8-8319-704d7b885ead', 'webtes2', '/www/wwwroot/webtes2.web.ximengnaikang.com2', '', 'git pull origin master', 'www', '3'),
-	('18730030-57e4-11e8-a173-704d7b885ead', 'university', '/www/wwwroot/university.web.ximengnaikang.com', '', 'git pull origin master', 'www', '3'),
-	('238f214f-52ae-11e8-803f-704d7b885ead', 'xmnk_api', '/www/wwwroot/api.web.ximengnaikang.com', '', 'git pull origin master', 'www', '3'),
-	('29f33c36-3fd5-11e9-ada6-e84e062b86ac', 'kabao', '/www/wwwroot/kabao.web.ximengnaikang.com', '', 'git pull origin master', 'www', '3'),
-	('36be7770-80b8-11e8-afae-704d7b885ead', 'cangku', '/www/wwwroot/cangku.web.ximengnaikang.com', '', 'git pull origin master', 'www', '3'),
-	('381f0b30-8742-11e8-a0b8-704d7b885ead', 'new_code1', '/www/wwwroot/code1.hnhemeile.com', '', 'git pull origin master', 'www', '3'),
-	('38daa500-55a8-11e8-acd6-704d7b885ead', 'zrjy', '/www/wwwroot/zrjy.web.ximengnaikang.com', '', 'git pull origin master', 'www', '3'),
-	('3d93b091-5013-11e8-aa3e-704d7b885ead', 'wxcdc', '/www/wwwroot/wxcdc.web.ximengnaikang.com', '', 'git pull origin master', 'www', '3'),
-	('3dd5d302-842b-11e8-9be2-525400c45bd1', 'tttest', '/www/wwwroot/tttest.web.ximengnaikang.com', '', 'git pull origin master', 'www', '3'),
-	('4707fbcf-a055-11e8-be22-704d7b885ead', 'wecenter', '/www/wwwroot/wecenter.web.ximengnaikang.com', '', 'git pull origin master', 'www', '3'),
-	('4832a040-8af8-11e8-95ec-704d7b885ead', 'yinglun', '/www/wwwroot/yinglun.web.ximengnaikang.com', '', 'git pull origin master', 'www', '3'),
-	('4c08d8c0-63ec-11e8-86d8-704d7b885ead', 'caidan', '/www/wwwroot/caidan.web.ximengnaikang.com', '', 'git pull origin master', 'www', '3'),
-	('5017ddf0-baf7-11e8-bfc2-704d7b885ead', 'dmglbgs', '/www/wwwroot/dmglbgs.web.ximengnaikang.com', '', 'git pull origin master', 'www', '3'),
-	('53505f30-bff0-11e8-9928-704d7b885ead', 'webtest2', '/www/wwwroot/webtest2.web.ximengnaikang.com', '', 'git pull origin master', 'www', '3'),
-	('55941800-b0b8-11e8-a3a0-704d7b885ead', 'xgzx', '/www/wwwroot/xgzx.web.ximengnaikang.com', '', 'git pull origin master', 'www', '3'),
-	('5b60df0a-e31e-11e8-aeb5-8505d7f1bbe2', 'hycloud', '/www/wwwroot/hycloud.web.ximengnaikang.com', '', 'git pull origin master', 'www', '3'),
-	('5b855112-c2ea-11e8-b5dc-704d7b885ead', 'yktang', '/www/wwwroot/yktang.web.ximengnaikang.com', '', 'git pull origin master', 'www', '3'),
-	('6311d221-60cb-11e8-a870-704d7b885ead', 'qinshang', '/www/wwwroot/qinshang.web.ximengnaikang.com', '', 'git pull origin master', 'www', '3'),
-	('6f5395e1-b0b8-11e8-92d7-704d7b885ead', 'xgzxhtml', '/www/wwwroot/xgzxhtml.web.ximengnaikang.com', '', 'git pull origin master', 'www', '3'),
-	('721f0e5a-179a-11e9-8235-2d0c3576eef0', 'tiexin', '/www/wwwroot/tiexin.web.ximengnaikang.com', '', 'git pull origin master', 'www', '3'),
-	('7e0eba30-a283-11e8-8780-704d7b885ead', 'yanbaoshow', '/www/wwwroot/yanbaoshow.web.ximengnaikang.com', '', 'git pull origin master', 'www', '3'),
-	('86247e28-bfef-11e8-a089-704d7b885ead', 'webtes', '/www/wwwroot/webtes.web.ximengnaikang.com', '', 'git pull origin master', 'www', '3'),
-	('8b30188f-6f97-11e8-b401-704d7b885ead', 'dnflite', '/www/wwwroot/dnflite.web.ximengnaikang.com', '', 'git pull origin master', 'www', '3'),
-	('96ce5de1-a6ad-11e8-a049-704d7b885ead', 'qlc', '/www/wwwroot/qlc.web.ximengnaikang.com', '', 'git pull origin master', 'www', '3'),
-	('979245a1-9700-11e8-9479-704d7b885ead', 'hsjx', '/www/wwwroot/hsjx.web.ximengnaikang.com', '', 'git pull origin master', 'www', '3'),
-	('9e2d00de-8fa7-11e8-af60-704d7b885ead', 'tqx', '/www/wwwroot/tqx.web.ximengnaikang.com', '', 'git pull origin master', 'www', '3'),
-	('a4af51cf-8740-11e8-b05f-704d7b885ead', 'new_code', '/www/wwwroot/code.hnhemeile.com', '', 'git pull origin master', 'www', '3'),
-	('a512fec0-4d2e-11e8-a7e5-704d7b885ead', 'bbbbtest', '/www/wwwroot/bbbbtest.xiimengnaikang.com', '', 'git pull origin master', 'www', '3'),
-	('bfe99e70-4ddd-11e8-87f9-704d7b885ead', 'tp_32_test', '/www/wwwroot/tp_32_test.web.ximengnaikang.com', '', 'git pull origin master', 'www', '3'),
-	('c5135900-4de1-11e8-8afc-704d7b885ead', 'html_test', '/www/wwwroot/html_test.web.ximengnaikang.com', '', 'git pull origin master', 'www', '3'),
-	('c87e8b7e-02b7-11e9-9884-b148c48e9157', 'hyygw', '/www/wwwroot/hyygw.web.ximengnaikang.com', '', 'git pull origin master', 'www', '3'),
-	('d63b11c0-5019-11e8-8fb4-704d7b885ead', 'yanbao', '/www/wwwroot/yanbao.web.ximengnaikang.com', '', 'git pull origin master', 'www', '3'),
-	('de92d4d0-cc78-11e8-b21f-6f43d347490b', 'qianyi', '/www/wwwroot/qianyi.web.ximengnaikang.com', '', 'git pull origin master', 'www', '3'),
-	('e3640596-02b6-11e9-bd5e-777287fdfd50', 'hyhtml', '/www/wwwroot/hyhtml.web.ximengnaikang.com', '', 'git pull origin master', 'www', '3'),
-	('eb928480-4dfe-11e8-a058-704d7b885ead', 'html1_test', '/www/wwwroot/html1_test.web.ximengnaikang.com', '', 'git pull origin master', 'www', '3'),
-	('ee5c0d30-4f9d-11e8-95a7-704d7b885ead', 'hhcc', '/www/wwwroot/hhcc.web.ximengnaikang.com', '', 'git pull origin master', 'www', '3'),
-	('xxdedee-seefexdce-esfsfe', 'bbbtest', '/www/wwwroot/bbbtest.web.ximengnaikang.com', '', 'git pull origin master', 'www', '3');
-/*!40000 ALTER TABLE `data` ENABLE KEYS */;
-
-/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
-/*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */;
-/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;

+ 0 - 60
db/db.py

@@ -1,60 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-# @File  : db.py.py
-# @Author: becivells
-#@Contact : becivells@gmail.com
-# @Date  : 2018/4/21
-#@Software : PyCharm
-# @Desc  :
-import os
-from sqlalchemy import Column,VARCHAR
-from sqlalchemy.ext.declarative import declarative_base
-from config import engine,session_class
-from config import repo as configrepo
-
-Base = declarative_base()
-class Data(Base):
-
-    __tablename__ = 'data'
-
-    id = Column(VARCHAR(40),primary_key=True,nullable=False)
-    name = Column(VARCHAR(30))
-    path = Column(VARCHAR(100))
-    ip = Column(VARCHAR(200))
-    cmd = Column(VARCHAR(100))
-    user = Column(VARCHAR(30))
-    interval = Column(VARCHAR(30))
-
-
-def get_dbconf():
-    session = session_class()
-    datas = session.query(Data).all()
-    session.close()
-    repo = {}
-    for data in datas:
-        if data:
-            if data.ip:
-               ip = data.ip.split(',')
-            else:
-                ip = ''
-            repo.update({data.id:{
-                    "name":data.name,
-                    "path":data.path,
-                    "ip":ip,
-                    "cmd":'git pull origin master',
-                    "user":data.user,
-                    'interval':3
-                    }})
-
-
-    return  repo
-
-
-
-
-# def init():
-#     Base.metadata.create_all(engine)
-#     print (get_dbconf())
-
-
-