mirror of https://github.com/jumpserver/jumpserver
perf: 增加DB_USE_SSL配置和redis配置统一
parent
3dde2a44e8
commit
69d8dc4bb3
|
@ -195,6 +195,7 @@ class Config(dict):
|
||||||
'DB_PORT': 3306,
|
'DB_PORT': 3306,
|
||||||
'DB_USER': 'root',
|
'DB_USER': 'root',
|
||||||
'DB_PASSWORD': '',
|
'DB_PASSWORD': '',
|
||||||
|
'DB_USE_SSL': False,
|
||||||
'REDIS_HOST': '127.0.0.1',
|
'REDIS_HOST': '127.0.0.1',
|
||||||
'REDIS_PORT': 6379,
|
'REDIS_PORT': 6379,
|
||||||
'REDIS_PASSWORD': '',
|
'REDIS_PASSWORD': '',
|
||||||
|
|
|
@ -198,13 +198,12 @@ DATABASES = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DB_CA_PATH = os.path.join(CERTS_DIR, 'db_ca.pem')
|
DB_USE_SSL = CONFIG.DB_USE_SSL
|
||||||
DB_USE_SSL = False
|
|
||||||
if CONFIG.DB_ENGINE.lower() == 'mysql':
|
if CONFIG.DB_ENGINE.lower() == 'mysql':
|
||||||
DB_OPTIONS['init_command'] = "SET sql_mode='STRICT_TRANS_TABLES'"
|
DB_OPTIONS['init_command'] = "SET sql_mode='STRICT_TRANS_TABLES'"
|
||||||
if os.path.isfile(DB_CA_PATH):
|
if DB_USE_SSL:
|
||||||
|
DB_CA_PATH = exist_or_default(os.path.join(CERTS_DIR, 'db_ca.pem'), None)
|
||||||
DB_OPTIONS['ssl'] = {'ca': DB_CA_PATH}
|
DB_OPTIONS['ssl'] = {'ca': DB_CA_PATH}
|
||||||
DB_USE_SSL = True
|
|
||||||
|
|
||||||
# Password validation
|
# Password validation
|
||||||
# https://docs.djangoproject.com/en/1.10/ref/settings/#auth-password-validators
|
# https://docs.djangoproject.com/en/1.10/ref/settings/#auth-password-validators
|
||||||
|
|
Loading…
Reference in New Issue