jumpserver/config_example.py

79 lines
2.3 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
# 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
2018-06-08 03:01:07 +00:00
DEBUG = os.environ.get("DEBUG") or True
2016-09-01 08:05:14 +00:00
# DEBUG, INFO, WARNING, ERROR, CRITICAL can set. See https://docs.djangoproject.com/en/1.10/topics/logging/
2018-06-08 03:01:07 +00:00
LOG_LEVEL = os.environ.get("LOG_LEVEL") or '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:
2018-06-08 03:01:07 +00:00
# DB_ENGINE = os.environ.get("DB_ENGINE") or 'mysql'
# DB_HOST = os.environ.get("DB_HOST") or '127.0.0.1'
# DB_PORT = os.environ.get("DB_PORT") or 3306
# DB_USER = os.environ.get("DB_USER") or 'jumpserver'
# DB_PASSWORD = os.environ.get("DB_PASSWORD") or 'weakPassword'
# DB_NAME = os.environ.get("DB_NAME") or 'jumpserver'
2016-09-01 08:05:14 +00:00
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
2018-06-08 03:01:07 +00:00
REDIS_HOST = os.environ.get("REDIS_HOST") or '127.0.0.1'
REDIS_PORT = os.environ.get("REDIS_PORT") or 6379
REDIS_PASSWORD = os.environ.get("REDIS_PASSWORD") or ''
REDIS_DB_CELERY = os.environ.get('REDIS_DB') or 3
REDIS_DB_CACHE = os.environ.get('REDIS_DB') or 4
2016-09-01 08:05:14 +00:00
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
2018-01-02 07:23:06 +00:00
config = DevelopmentConfig()
2016-08-20 12:35:58 +00:00