mdserver-web/setting.py

48 lines
1.1 KiB
Python
Raw Permalink Normal View History

2018-12-20 08:45:09 -05:00
# coding:utf-8
2019-02-18 07:05:30 -05:00
2018-12-12 05:06:02 -05:00
import time
import sys
2019-02-18 07:05:30 -05:00
import os
2018-12-12 12:14:25 -05:00
chdir = os.getcwd()
sys.path.append(chdir + '/class/core')
2019-03-15 06:02:09 -04:00
sys.path.append("/usr/local/lib/python2.7/site-packages")
2020-07-10 03:57:25 -04:00
import mw
2018-12-12 12:09:38 -05:00
import system_api
2019-07-31 09:42:29 -04:00
cpu_info = system_api.system_api().getCpuInfo()
workers = cpu_info[1]
2019-02-18 11:01:30 -05:00
2018-12-12 12:09:38 -05:00
2018-12-12 05:45:33 -05:00
if not os.path.exists(os.getcwd() + '/logs'):
os.mkdir(os.getcwd() + '/logs')
2018-12-12 05:06:02 -05:00
2020-07-10 03:57:25 -04:00
mw_port = mw.readFile('data/port.pl')
2019-02-19 01:10:06 -05:00
if mw_port:
mw_port.strip()
bind = []
if os.path.exists('data/ipv6.pl'):
bind.append('[0:0:0:0:0:0:0:0]:%s' % mw_port)
else:
bind.append('0.0.0.0:%s' % mw_port)
2019-02-18 11:01:30 -05:00
2019-07-31 09:42:29 -04:00
if workers > 2:
workers = 2
2019-07-31 09:42:52 -04:00
threads = workers * 1
2018-12-12 05:06:02 -05:00
backlog = 512
2019-02-18 11:01:30 -05:00
reload = False
2018-12-12 12:14:25 -05:00
daemon = True
2019-02-18 11:01:30 -05:00
worker_class = 'geventwebsocket.gunicorn.workers.GeventWebSocketWorker'
2018-12-12 05:06:02 -05:00
timeout = 7200
2019-02-18 11:01:30 -05:00
keepalive = 60
preload_app = True
2018-12-12 05:45:33 -05:00
capture_output = True
access_log_format = '%(t)s %(p)s %(h)s "%(r)s" %(s)s %(L)s %(b)s %(f)s" "%(a)s"'
loglevel = 'info'
2018-12-12 12:14:25 -05:00
errorlog = chdir + '/logs/error.log'
accesslog = chdir + '/logs/access.log'
pidfile = chdir + '/logs/mw.pid'
2018-12-28 23:42:29 -05:00
if os.path.exists(os.getcwd() + '/data/ssl.pl'):
certfile = 'ssl/certificate.pem'
keyfile = 'ssl/privateKey.pem'