jumpserver/config_example.py

124 lines
3.5 KiB
Python
Raw Normal View History

2016-08-20 12:35:58 +00:00
"""
jumpserver.config
~~~~~~~~~~~~~~~~~
Jumpserver project setting file
2017-12-21 18:08:29 +00:00
:copyright: (c) 2014-2017 by Jumpserver Team
2016-08-20 12:35:58 +00:00
:license: GPL v2, see LICENSE for more details.
"""
import os
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
class Config:
2016-09-01 08:05:14 +00:00
# Use it to encrypt or decrypt data
# SECURITY WARNING: keep the secret key used in production secret!
2016-08-20 12:35:58 +00:00
SECRET_KEY = os.environ.get('SECRET_KEY') or '2vym+ky!997d5kkcc64mnz06y1mmui3lut#(^wd=%s_qj$1%x'
2016-09-01 08:05:14 +00:00
2017-12-21 10:54:29 +00:00
# How many line display every page if using django pager, default 25
2017-01-20 12:13:22 +00:00
DISPLAY_PER_PAGE = 25
2016-09-01 08:05:14 +00:00
# It's used to identify your site, When we send a create mail to user, we only know login url is /login/
# But we should know the absolute url like: http://jms.jumpserver.org/login/, so SITE_URL is
# HTTP_PROTOCOL://HOST[:PORT]
SITE_URL = 'http://localhost'
# Django security setting, if your disable debug model, you should setting that
2016-08-20 12:35:58 +00:00
ALLOWED_HOSTS = ['*']
2016-09-01 08:05:14 +00:00
# Development env open this, when error occur display the full process track, Production disable it
DEBUG = True
# DEBUG, INFO, WARNING, ERROR, CRITICAL can set. See https://docs.djangoproject.com/en/1.10/topics/logging/
2016-08-31 11:48:37 +00:00
LOG_LEVEL = 'DEBUG'
2017-12-21 10:54:29 +00:00
LOG_DIR = os.path.join(BASE_DIR, 'logs')
2016-09-01 08:05:14 +00:00
# Database setting, Support sqlite3, mysql, postgres ....
# See https://docs.djangoproject.com/en/1.10/ref/settings/#databases
2017-12-21 10:54:29 +00:00
# SQLite setting:
DB_ENGINE = 'sqlite3'
2017-05-17 01:42:32 +00:00
DB_NAME = os.path.join(BASE_DIR, 'data', 'db.sqlite3')
2016-09-01 08:05:14 +00:00
2017-12-21 10:54:29 +00:00
# MySQL or postgres setting like:
2016-09-01 08:05:14 +00:00
# DB_ENGINE = 'mysql'
# DB_HOST = '127.0.0.1'
# DB_PORT = 3306
# DB_USER = 'root'
# DB_PASSWORD = ''
# DB_NAME = 'jumpserver'
2017-12-21 18:08:29 +00:00
# When Django start it will bind this host and port
# ./manage.py runserver 127.0.0.1:8080
HTTP_BIND_HOST = '0.0.0.0'
HTTP_LISTEN_PORT = 8080
2016-09-01 08:05:14 +00:00
# Use Redis as broker for celery and web socket
2016-08-31 07:54:04 +00:00
REDIS_HOST = '127.0.0.1'
REDIS_PORT = 6379
2016-11-03 16:41:21 +00:00
REDIS_PASSWORD = ''
BROKER_URL = 'redis://%(password)s%(host)s:%(port)s/3' % {
'password': REDIS_PASSWORD,
'host': REDIS_HOST,
'port': REDIS_PORT,
}
2016-09-01 08:05:14 +00:00
2017-12-21 10:54:29 +00:00
# Api token expiration when create, Jumpserver refresh time when request arrive
2016-10-31 10:58:23 +00:00
TOKEN_EXPIRATION = 3600
2017-12-21 10:54:29 +00:00
# Session and csrf domain settings
SESSION_COOKIE_AGE = 3600*24
2016-09-01 08:05:14 +00:00
# Email SMTP setting, we only support smtp send mail
2017-12-21 10:54:29 +00:00
EMAIL_HOST = 'smtp.163.com'
EMAIL_PORT = 25
EMAIL_HOST_USER = ''
EMAIL_HOST_PASSWORD = '' # Caution: Some SMTP server using `Authorization Code` except password
EMAIL_USE_SSL = True if EMAIL_PORT == 465 else False
EMAIL_USE_TLS = True if EMAIL_PORT == 587 else False
EMAIL_SUBJECT_PREFIX = '[Jumpserver] '
2016-08-20 12:35:58 +00:00
CAPTCHA_TEST_MODE = False
2017-03-31 15:46:00 +00:00
# You can set jumpserver usage url here, that when user submit wizard redirect to
USER_GUIDE_URL = ''
2017-07-10 02:26:17 +00:00
# LDAP Auth settings
AUTH_LDAP = False
AUTH_LDAP_SERVER_URI = 'ldap://localhost:389'
AUTH_LDAP_BIND_DN = 'cn=admin,dc=jumpserver,dc=org'
AUTH_LDAP_BIND_PASSWORD = ''
2017-10-12 06:29:00 +00:00
AUTH_LDAP_SEARCH_OU = 'ou=tech,dc=jumpserver,dc=org'
AUTH_LDAP_SEARCH_FILTER = '(cn=%(user)s)'
2017-07-10 02:26:17 +00:00
AUTH_LDAP_USER_ATTR_MAP = {
"username": "cn",
"name": "sn",
"email": "mail"
}
AUTH_LDAP_START_TLS = False
2016-08-20 12:35:58 +00:00
def __init__(self):
pass
2016-10-31 10:58:30 +00:00
def __getattr__(self, item):
2016-08-20 12:35:58 +00:00
return None
2017-12-21 18:08:29 +00:00
class DevelopmentConfig(Config):
pass
class TestConfig(Config):
pass
class ProductionConfig(Config):
pass
# Default using Config settings, you can write if/else for different env
config = Config()
2016-08-20 12:35:58 +00:00