-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
112 additions
and
97 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
------------------------------------------------- | ||
File Name: launcher | ||
Description : 启动器 | ||
Author : JHao | ||
date: 2021/3/26 | ||
------------------------------------------------- | ||
Change Activity: | ||
2021/3/26: 启动器 | ||
------------------------------------------------- | ||
""" | ||
__author__ = 'JHao' | ||
|
||
import sys | ||
from db.dbClient import DbClient | ||
from handler.logHandler import LogHandler | ||
from handler.configHandler import ConfigHandler | ||
|
||
log = LogHandler('launcher') | ||
|
||
|
||
def startServer(): | ||
__beforeStart() | ||
from api.proxyApi import runFlask | ||
runFlask() | ||
|
||
|
||
def startScheduler(): | ||
__beforeStart() | ||
from helper.scheduler import runScheduler | ||
runScheduler() | ||
|
||
|
||
def __beforeStart(): | ||
__showVersion() | ||
__showConfigure() | ||
if __checkDBConfig(): | ||
log.info('exit!') | ||
sys.exit() | ||
|
||
|
||
def __showVersion(): | ||
from setting import VERSION | ||
log.info("ProxyPool Version: %s" % VERSION) | ||
|
||
|
||
def __showConfigure(): | ||
conf = ConfigHandler() | ||
log.info("ProxyPool configure HOST: %s" % conf.serverHost) | ||
log.info("ProxyPool configure PORT: %s" % conf.serverPort) | ||
log.info("ProxyPool configure DB_CONN: %s" % conf.dbConn) | ||
log.info("ProxyPool configure PROXY_FETCHER: %s" % conf.fetchers) | ||
|
||
|
||
def __checkDBConfig(): | ||
conf = ConfigHandler() | ||
db = DbClient(conf.dbConn) | ||
log.info("============ DATABASE CONFIGURE ================") | ||
log.info("DB_TYPE: %s" % db.db_type) | ||
log.info("DB_HOST: %s" % db.db_host) | ||
log.info("DB_PORT: %s" % db.db_port) | ||
log.info("DB_NAME: %s" % db.db_name) | ||
log.info("DB_USER: %s" % db.db_user) | ||
log.info("=================================================") | ||
return db.test() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters