From dceef9c340f8d4ebc49bce09a065b89a6805a12c Mon Sep 17 00:00:00 2001 From: jiangweidong Date: Mon, 27 Jun 2022 16:13:42 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E9=83=A8=E7=BD=B2?= =?UTF-8?q?=E5=9C=A8=E6=97=A0=E8=AF=81=E4=B9=A6=E7=9A=84Redis=E4=B8=8A?= =?UTF-8?q?=EF=BC=8C=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1=E4=B8=8D=E6=89=A7?= =?UTF-8?q?=E8=A1=8C=E7=9A=84=E9=97=AE=E9=A2=98-v2.21?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/start_celery_beat.py | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/utils/start_celery_beat.py b/utils/start_celery_beat.py index 946fe9172..8a978837c 100644 --- a/utils/start_celery_beat.py +++ b/utils/start_celery_beat.py @@ -12,33 +12,23 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) APPS_DIR = os.path.join(BASE_DIR, 'apps') sys.path.insert(0, BASE_DIR) +sys.path.insert(0, APPS_DIR) from apps.jumpserver.const import CONFIG +from apps.jumpserver.settings import base as jms_settings os.environ.setdefault('PYTHONOPTIMIZE', '1') if os.getuid() == 0: os.environ.setdefault('C_FORCE_ROOT', '1') -REDIS_SSL_KEYFILE = os.path.join(BASE_DIR, 'data', 'certs', 'redis_client.key') -if not os.path.exists(REDIS_SSL_KEYFILE): - REDIS_SSL_KEYFILE = None - -REDIS_SSL_CERTFILE = os.path.join(BASE_DIR, 'data', 'certs', 'redis_client.crt') -if not os.path.exists(REDIS_SSL_CERTFILE): - REDIS_SSL_CERTFILE = None - -REDIS_SSL_CA_CERTS = os.path.join(BASE_DIR, 'data', 'certs', 'redis_ca.crt') -if not os.path.exists(REDIS_SSL_CA_CERTS): - REDIS_SSL_CA_CERTS = os.path.join(BASE_DIR, 'data', 'certs', 'redis_ca.pem') - params = { 'host': CONFIG.REDIS_HOST, 'port': CONFIG.REDIS_PORT, 'password': CONFIG.REDIS_PASSWORD, "ssl": CONFIG.REDIS_USE_SSL, 'ssl_cert_reqs': CONFIG.REDIS_SSL_REQUIRED, - "ssl_keyfile": REDIS_SSL_KEYFILE, - "ssl_certfile": REDIS_SSL_CERTFILE, - "ssl_ca_certs": REDIS_SSL_CA_CERTS + "ssl_keyfile": jms_settings.REDIS_SSL_KEYFILE, + "ssl_certfile": jms_settings.REDIS_SSL_CERTFILE, + "ssl_ca_certs": jms_settings.REDIS_SSL_CA_CERTS } redis = Redis(**params) scheduler = "django_celery_beat.schedulers:DatabaseScheduler"