from superset.jinja_context import ( # pylint: disable=unused-import BaseTemplateProcessor, ) from superset.stats_logger import DummyStatsLogger from superset.typing import CacheConfig from superset.utils.log import DBEventLogger from superset.utils.logging_configurator import DefaultLoggingConfigurator logger = logging.getLogger(__name__) if TYPE_CHECKING: from flask_appbuilder.security.sqla import models # pylint: disable=unused-import from superset.models.core import Database # pylint: disable=unused-import # Realtime stats logger, a StatsD implementation exists STATS_LOGGER = DummyStatsLogger() EVENT_LOGGER = DBEventLogger() SUPERSET_LOG_VIEW = True BASE_DIR = os.path.abspath(os.path.dirname(__file__)) if "SUPERSET_HOME" in os.environ: DATA_DIR = os.environ["SUPERSET_HOME"] else: DATA_DIR = os.path.join(os.path.expanduser("~"), ".superset") # --------------------------------------------------------- # Superset specific config # --------------------------------------------------------- VERSION_INFO_FILE = os.path.join(BASE_DIR, "static", "version_info.json") PACKAGE_JSON_FILE = os.path.join(BASE_DIR, "static", "assets", "package.json")
"redis": "redis://{password}{host}:{port}/{db}".format( password="******".format(get_env("CELERY_REDIS_RESULT_BACKEND_PASSWORD")) if get_env("CELERY_REDIS_RESULT_BACKEND_PASSWORD") else "", host=get_env("CELERY_REDIS_RESULT_BACKEND_HOST"), port=get_env("CELERY_REDIS_RESULT_BACKEND_PORT", default=6379), db=get_env("CELERY_REDIS_RESULT_BACKEND_DB", default=1)), "memcached": "cache+memcached://{servers}/".format(servers=";".join( get_env( "CELERY_MEMCACHED_RESULT_BACKEND_SERVERS", default=[], cast=list))) } STATS_LOGGERS = { "dummy": lambda: DummyStatsLogger(prefix=get_env("DUMMY_STATS_LOGGER_PREFIX", default="superset")), "statsd": lambda: StatsdStatsLogger( host=get_env("STATSD_STATS_LOGGER_HOST", default="localhost"), port=get_env("STATSD_STATS_LOGGER_PORT", default=8125, cast=int), prefix=get_env("STATSD_STATS_LOGGER_PREFIX", default="superset")) } def get_db_or_broker_uri(env_var_prefix, default_prefixes, default_ports): type = get_env("{}_TYPE".format(env_var_prefix)) try: username = get_env("{}_USERNAME".format(env_var_prefix)) password = get_env("{}_PASSWORD".format(env_var_prefix))