Example #1
0
# APP_VERSION_INT for cache busting on version upgrade. If the value is set as
# None or empty string then it will not be added.
# eg - http:localhost:5050/pgadmin.css?intver=3.13
APP_VERSION_PARAM = 'ver'

# Add the internal version param to below extensions only
APP_VERSION_EXTN = ('.css', '.js', '.html', '.svg', '.png', '.gif', '.ico')

# Data directory for storage of config settings etc. This shouldn't normally
# need to be changed - it's here as various other settings depend on it.
# On Windows, we always store data in %APPDATA%\pgAdmin. On other platforms,
# if we're in server mode we use /var/lib/pgadmin, otherwise ~/.pgadmin
if IS_WIN:
    # Use the short path on windows
    DATA_DIR = os.path.realpath(
        os.path.join(fs_short_path(env('APPDATA')), u"pgAdmin"))
else:
    if SERVER_MODE:
        DATA_DIR = '/var/lib/pgadmin'
    else:
        DATA_DIR = os.path.realpath(os.path.expanduser(u'~/.pgadmin/'))

##########################################################################
# Log settings
##########################################################################

# Debug mode?
DEBUG = False

# Application log level - one of:
#   CRITICAL 50
#       longer part of the main configuration, but are stored in the
#       configuration databases 'keys' table and are auto-generated.

# Should HTML be minified on the fly when not in debug mode?
# NOTE: The HTMLMIN module doesn't work with Python 2.6, so this option
#       has no effect on <= Python 2.7.
MINIFY_PAGE = True

# Data directory for storage of config settings etc. This shouldn't normally
# need to be changed - it's here as various other settings depend on it.
# On Windows, we always store data in %APPDATA%\pgAdmin. On other platforms,
# if we're in server mode we use /var/lib/pgadmin, otherwise ~/.pgadmin
if IS_WIN:
    # Use the short path on windows
    DATA_DIR = os.path.realpath(
        os.path.join(fs_short_path(env('APPDATA')), u"pgAdmin")
    )
else:
    if SERVER_MODE:
        DATA_DIR = '/var/lib/pgadmin'
    else:
        DATA_DIR = os.path.realpath(os.path.expanduser(u'~/.pgadmin/'))


##########################################################################
# Log settings
##########################################################################

# Debug mode?
DEBUG = False
#       longer part of the main configuration, but are stored in the
#       configuration databases 'keys' table and are auto-generated.

# Should HTML be minified on the fly when not in debug mode?
# NOTE: The HTMLMIN module doesn't work with Python 2.6, so this option
#       has no effect on <= Python 2.7.
MINIFY_PAGE = True

# Data directory for storage of config settings etc. This shouldn't normally
# need to be changed - it's here as various other settings depend on it.
# On Windows, we always store data in %APPDATA%\pgAdmin. On other platforms,
# if we're in server mode we use /var/lib/pgadmin, otherwise ~/.pgadmin
if IS_WIN:
    # Use the short path on windows
    DATA_DIR = os.path.realpath(
        os.path.join(fs_short_path(env('APPDATA')), u"pgAdmin")
    )
else:
    if SERVER_MODE:
        DATA_DIR = '/var/lib/pgadmin'
    else:
        DATA_DIR = os.path.realpath(os.path.expanduser(u'~/.pgadmin/'))


##########################################################################
# Log settings
##########################################################################

# Debug mode?
DEBUG = False
""" sample config & documenation.

https://www.pgadmin.org/docs/pgadmin4/latest/config_py.html
"""

import os
from pgadmin.utils import env, fs_short_path
# from typing import List


SERVER_MODE = True
X_FRAME_OPTIONS = ""
## the below CAN NOT BE SET TO AN EMPTY LIST
# WTF_CSRF_HEADERS: List[str] = []  # ['X-pgA-CSRFToken']
UPGRADE_CHECK_ENABLED = str.lower(env('PGADMIN_CONFIG_UPGRADE_CHECK_ENABLED')) == "true"
USER_INACTIVITY_TIMEOUT = 0
SESSION_EXPIRATION_TIME = 365

DEFAULT_SERVER = '127.0.0.1'
DEFAULT_SERVER_PORT = int(env('PGADMIN_LISTEN_PORT'))  # Note: this has no effect since I am hosting it as a WSGI application

UPGRADE_CHECK_KEY = 'pgadmin4'


###### PATHS ######

SQLITE_PATH             = os.path.realpath(env('PGADMIN_SQLITE_PATH'))
SESSION_DB_PATH         = os.path.realpath( os.path.join(fs_short_path(env('PGADMIN_DATA_DIR')), "sessions"))
STORAGE_DIR             = os.path.realpath( os.path.join(fs_short_path(env('PGADMIN_DATA_DIR')), "storage"))
DEFAULT_BINARY_PATHS    = {"pg": "C:\\pgsql\\bin", "ppas": "", "gpdb": ""}
DATA_DIR                = os.path.realpath( fs_short_path(env('PGADMIN_DATA_DIR') ) )
Example #5
0
#       longer part of the main configuration, but are stored in the
#       configuration databases 'keys' table and are auto-generated.

# Should HTML be minified on the fly when not in debug mode?
# NOTE: The HTMLMIN module doesn't work with Python 2.6, so this option
#       has no effect on <= Python 2.7.
MINIFY_PAGE = True

# Data directory for storage of config settings etc. This shouldn't normally
# need to be changed - it's here as various other settings depend on it.
# On Windows, we always store data in %APPDATA%\pgAdmin. On other platforms,
# if we're in server mode we use /var/lib/pgadmin, otherwise ~/.pgadmin
if IS_WIN:
    # Use the short path on windows
    DATA_DIR = os.path.realpath(
        os.path.join(fs_short_path(env('APPDATA')), u"pgAdmin")
    )
else:
    if SERVER_MODE:
        DATA_DIR = '/var/lib/pgadmin'
    else:
        DATA_DIR = os.path.realpath(os.path.expanduser(u'~/.pgadmin/'))

##########################################################################
# Log settings
##########################################################################

# Debug mode?
DEBUG = False

# Application log level - one of: