# -*- coding: utf-8 -*- ########################################################################## # # pgAdmin 4 - PostgreSQL Tools # # Copyright (C) 2013 - 2026, The pgAdmin Development Team # This software is released under the PostgreSQL Licence # # config.py - Core application configuration settings # ########################################################################## import builtins import logging import os import sys from collections import OrderedDict # We need to include the root directory in sys.path to ensure that we can # find everything we need when running in the standalone runtime. root = os.path.dirname(os.path.realpath(__file__)) if sys.path[0] != root: sys.path.insert(0, root) # The config database connection pool size. # Setting this to 0 will remove any limit. CONFIG_DATABASE_CONNECTION_POOL_SIZE = 5 # The number of connections allowed to overflow beyond # the connection pool size. CONFIG_DATABASE_CONNECTION_MAX_OVERFLOW = 100 from pgadmin.utils import env, IS_WIN, fs_short_path from version import APP_VERSION, APP_RELEASE, APP_REVISION, APP_SUFFIX, \ APP_VERSION_INT from branding import APP_NAME, APP_ICON, APP_COPYRIGHT, APP_PATH, \ APP_WIN_PATH, APP_SHORT_NAME, APP_DEFAULT_EMAIL ########################################################################## # Misc stuff ########################################################################## # Path to the online help. HELP_PATH = '../../../docs/en_US/_build/html/' # Languages we support in the UI # Babel's locale data for other languages is removed from the packages by # pkg/prune_site_packages.py, which parses this assignment, so it must stay a # plain dict literal. LANGUAGES = { 'en': 'English', 'zh_Hans_CN': 'Chinese (Simplified)', 'zh_Hant_TW': 'Chinese (Traditional)', 'cs': 'Czech', 'fr': 'French', 'de': 'German', 'id': 'Indonesian', 'it': 'Italian', 'ja': 'Japanese', 'ko': 'Korean', 'pl': 'Polish', 'pt_BR': 'Portuguese (Brazilian)', 'ru': 'Russian', 'es': 'Spanish', 'sv': 'Swedish' } # DO NOT CHANGE UNLESS YOU KNOW WHAT YOU ARE DOING! # List of modules to skip when dynamically loading MODULE_BLACKLIST = ['test'] # DO NOT CHANGE UNLESS YOU KNOW WHAT YOU ARE DOING! # List of treeview browser nodes to skip when dynamically loading NODE_BLACKLIST = [] ########################################################################## # Server settings ########################################################################## # The server mode determines whether or not we're running on a web server # requiring user authentication, or desktop mode which uses an automatic # default login. # # DO NOT DISABLE SERVER MODE IF RUNNING ON A WEBSERVER!! # # We only set SERVER_MODE if it's not already set. That's to allow the # runtime to force it to False. # # NOTE: If you change the value of SERVER_MODE or DATA_DIR in an included # config file, you may also need to redefine any values below that are # derived from it, notably various paths such as LOG_FILE, SQLITE_PATH, # SESSION_DB_PATH, STORAGE_DIR, KERBEROS_CCACHE_DIR, and # AZURE_CREDENTIAL_CACHE_DIR if (not hasattr(builtins, 'SERVER_MODE')) or builtins.SERVER_MODE is None: SERVER_MODE = True else: SERVER_MODE = builtins.SERVER_MODE # HTTP headers to search for CSRF token when it is not provided in the form. # Default is ['X-CSRFToken', 'X-CSRF-Token'] WTF_CSRF_HEADERS = ['X-pgA-CSRFToken'] # User ID (email address) to use for the default user in desktop mode. # The default should be fine here, as it's not exposed in the app. DESKTOP_USER = APP_DEFAULT_EMAIL # This option allows the user to host the application on a LAN # Default hosting is on localhost (DEFAULT_SERVER='localhost'). # To host pgAdmin4 over LAN set DEFAULT_SERVER='0.0.0.0' (or a specific # adaptor address. # # NOTE: This is NOT recommended for production use, only for debugging # or testing. Production installations should be run as a WSGI application # behind Apache HTTPD. DEFAULT_SERVER = '127.0.0.1' # The default port on which the app server will listen if not set in the # environment by the runtime DEFAULT_SERVER_PORT = 5050 # This param is used to override the default web server information about # the web technology and the frameworks being used in the application # An attacker could use this information to fingerprint underlying operating # system and research known exploits for the specific version of # software in use WEB_SERVER = 'Python' # Enable X-Frame-Option protection. # Set to one of "SAMEORIGIN", "ALLOW-FROM origin" or "" to disable. # Note that "DENY" is NOT supported (and will be silently ignored). # See https://tools.ietf.org/html/rfc7034 for more info. X_FRAME_OPTIONS = "SAMEORIGIN" # The Cross-Origin-Opener-Policy allows a website to control whether # a new top-level document, opened using Window.open() or by navigating # to a new page, is opened in the same browsing context group (BCG) # or in a new browsing context group. # Set to 'unsafe-none', 'same-origin-allow-popups', 'same-origin', # or 'noopener-allow-popups' CROSS_ORIGIN_OPENER_POLICY = "same-origin" # The Content-Security-Policy header allows you to restrict how resources # such as JavaScript, CSS, or pretty much anything that the browser loads. # see https://content-security-policy.com/#source_list for more info # e.g. "default-src https: data: 'unsafe-inline' 'unsafe-eval';" # # A per-request nonce is used in place of 'unsafe-inline' for scripts. The # literal token {nonce} anywhere in the policy is replaced at runtime with a # freshly generated nonce that is also emitted on pgAdmin's inline