mirror of https://github.com/jumpserver/jumpserver
commit
613a7d63b5
|
@ -485,8 +485,7 @@ class Config(dict):
|
|||
'SECURITY_DATA_CRYPTO_ALGO': None,
|
||||
'GMSSL_ENABLED': False,
|
||||
# Magnus 组件需要监听的端口范围
|
||||
'MAGNUS_DB_PORTS_START': 30000,
|
||||
'MAGNUS_DB_PORTS_LIMIT_COUNT': 1000,
|
||||
'MAGNUS_PORTS': '30000-30100',
|
||||
|
||||
# 记录清理清理
|
||||
'LOGIN_LOG_KEEP_DAYS': 200,
|
||||
|
|
|
@ -179,5 +179,4 @@ SESSION_RSA_PRIVATE_KEY_NAME = 'jms_private_key'
|
|||
SESSION_RSA_PUBLIC_KEY_NAME = 'jms_public_key'
|
||||
|
||||
# Magnus DB Port
|
||||
MAGNUS_DB_PORTS_START = CONFIG.MAGNUS_DB_PORTS_START
|
||||
MAGNUS_DB_PORTS_LIMIT_COUNT = CONFIG.MAGNUS_DB_PORTS_LIMIT_COUNT
|
||||
MAGNUS_PORTS = CONFIG.MAGNUS_PORTS
|
||||
|
|
|
@ -21,7 +21,7 @@ def init_db_port_mapper(sender, **kwargs):
|
|||
try:
|
||||
db_port_manager.init()
|
||||
except (ProgrammingError,) as e:
|
||||
logger.error('Init db port mapper error: {}'.format(e))
|
||||
pass
|
||||
|
||||
|
||||
@receiver(post_save, sender=Application)
|
||||
|
|
|
@ -20,15 +20,20 @@ class DBPortManager(object):
|
|||
CACHE_KEY = 'PORT_DB_MAPPER'
|
||||
|
||||
def __init__(self):
|
||||
self.port_start = settings.MAGNUS_DB_PORTS_START
|
||||
self.port_limit = settings.MAGNUS_DB_PORTS_LIMIT_COUNT
|
||||
self.port_end = self.port_start + self.port_limit
|
||||
try:
|
||||
port_start, port_end = settings.MAGNUS_PORTS.split('-')
|
||||
port_start, port_end = int(port_start), int(port_end)
|
||||
except Exception as e:
|
||||
logger.error('MAGNUS_PORTS config error: {}'.format(e))
|
||||
port_start, port_end = 30000, 30100
|
||||
|
||||
self.port_start, self.port_end = port_start, port_end
|
||||
# 可以使用的端口列表
|
||||
self.all_available_ports = list(range(self.port_start, self.port_end))
|
||||
self.all_available_ports = list(range(self.port_start, self.port_end + 1))
|
||||
|
||||
@property
|
||||
def magnus_listen_port_range(self):
|
||||
return f'{self.port_start}-{self.port_end - 1}'
|
||||
return settings.MAGNUS_PORTS
|
||||
|
||||
def init(self):
|
||||
with tmp_to_root_org():
|
||||
|
|
Loading…
Reference in New Issue