2024-01-31 14:54:27 +01:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
2024-02-27 23:20:13 +01:00
|
|
|
import builtins
|
|
|
|
import logging
|
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
|
|
|
|
##########################################################################
|
|
|
|
# Server settings
|
|
|
|
##########################################################################
|
|
|
|
|
|
|
|
SERVER_MODE = True
|
|
|
|
|
|
|
|
DATA_DIR = '__DATA_DIR__'
|
|
|
|
REGISTRY_CONFIG_FILE = '__INSTALL_DIR__/postgres-reg.ini'
|
|
|
|
|
|
|
|
##########################################################################
|
|
|
|
# Log settings
|
|
|
|
##########################################################################
|
|
|
|
|
|
|
|
# Debug mode?
|
|
|
|
DEBUG = False
|
|
|
|
|
|
|
|
# Application log level - one of:
|
|
|
|
# CRITICAL 50
|
|
|
|
# ERROR 40
|
|
|
|
# WARNING 30
|
|
|
|
# SQL 25
|
|
|
|
# INFO 20
|
|
|
|
# DEBUG 10
|
|
|
|
# NOTSET 0
|
|
|
|
CONSOLE_LOG_LEVEL = logging.WARNING
|
|
|
|
FILE_LOG_LEVEL = logging.WARNING
|
|
|
|
|
|
|
|
# Log format.
|
|
|
|
CONSOLE_LOG_FORMAT = '%(asctime)s: %(levelname)s\t%(name)s:\t%(message)s'
|
|
|
|
FILE_LOG_FORMAT = '%(asctime)s: %(levelname)s\t%(name)s:\t%(message)s'
|
|
|
|
|
|
|
|
# Log file name
|
|
|
|
LOG_FILE = '/var/log/__APP__/pgadmin4.log'
|
|
|
|
|
|
|
|
# Log rotation setting
|
|
|
|
# Log file will be rotated considering values for LOG_ROTATION_SIZE
|
|
|
|
# & LOG_ROTATION_AGE. Rotated file will be named in format
|
|
|
|
# - LOG_FILE.Y-m-d_H-M-S
|
|
|
|
LOG_ROTATION_SIZE = 10 # In MBs
|
|
|
|
LOG_ROTATION_AGE = 1440 # In minutes
|
|
|
|
LOG_ROTATION_MAX_LOG_FILES = 90 # Maximum number of backups to retain
|
|
|
|
|
|
|
|
##########################################################################
|
|
|
|
# Mail server settings
|
|
|
|
##########################################################################
|
|
|
|
|
|
|
|
# These settings are used when running in web server mode for confirming
|
|
|
|
# and resetting passwords etc.
|
|
|
|
# See: http://pythonhosted.org/Flask-Mail/ for more info
|
|
|
|
MAIL_SERVER = '__DOMAIN__'
|
|
|
|
MAIL_PORT = 587
|
|
|
|
MAIL_USE_SSL = True
|
|
|
|
MAIL_USE_TLS = False
|
|
|
|
MAIL_USERNAME = '__APP__'
|
|
|
|
MAIL_PASSWORD = '__MAIL_PWD__'
|
|
|
|
MAIL_DEBUG = False
|
|
|
|
|
|
|
|
# Flask-Security overrides Flask-Mail's MAIL_DEFAULT_SENDER setting, so
|
|
|
|
# that should be set as such:
|
|
|
|
SECURITY_EMAIL_SENDER = '__APP__@__DOMAIN__'
|
|
|
|
|
|
|
|
##########################################################################
|
|
|
|
# Master password is used to encrypt/decrypt saved server passwords
|
|
|
|
# Applicable for desktop mode only
|
|
|
|
##########################################################################
|
|
|
|
MASTER_PASSWORD_REQUIRED = True
|
|
|
|
|
|
|
|
##########################################################################
|
|
|
|
|
|
|
|
# pgAdmin encrypts the database connection and ssh tunnel password using a
|
|
|
|
# master password or pgAdmin login password (for other authentication sources)
|
|
|
|
# before storing it in the pgAdmin configuration database.
|
|
|
|
#
|
|
|
|
# Below setting is used to allow the user to specify the path to a script
|
|
|
|
# or program that will return an encryption key which will be used to
|
|
|
|
# encrypt the passwords. This setting is used only in server mode when
|
|
|
|
# auth sources are oauth, Kerberos, and webserver.
|
|
|
|
#
|
|
|
|
# You can pass the current username as an argument to the external script
|
|
|
|
# by specifying %u in config value.
|
|
|
|
# E.g. - MASTER_PASSWORD_HOOK = '<PATH>/passwdgen_script.sh %u'
|
|
|
|
##########################################################################
|
|
|
|
MASTER_PASSWORD_HOOK = 'cat __DATA_DIR__/master_pwd'
|
|
|
|
|
|
|
|
##########################################################################
|
|
|
|
# External Authentication Sources
|
|
|
|
##########################################################################
|
|
|
|
|
|
|
|
# Default setting is internal
|
|
|
|
# External Supported Sources: ldap, kerberos, oauth2
|
|
|
|
# Multiple authentication can be achieved by setting this parameter to
|
|
|
|
# ['ldap', 'internal'] or ['oauth2', 'internal'] or
|
|
|
|
# ['webserver', 'internal'] etc.
|
|
|
|
# pgAdmin will authenticate the user with ldap/oauth2 whatever first in the
|
|
|
|
# list, in case of failure the second authentication option will be considered.
|
|
|
|
|
|
|
|
AUTHENTICATION_SOURCES = ['webserver']
|
|
|
|
|
|
|
|
##########################################################################
|
|
|
|
# Webserver Configuration
|
|
|
|
##########################################################################
|
|
|
|
|
|
|
|
WEBSERVER_AUTO_CREATE_USER = True
|
|
|
|
|
|
|
|
# REMOTE_USER variable will be used to check the environment variable
|
|
|
|
# is set or not first, if not available,
|
|
|
|
# request header will be checked for the same.
|
|
|
|
# Possible values: REMOTE_USER, HTTP_X_FORWARDED_USER, X-Forwarded-User
|
|
|
|
|
|
|
|
WEBSERVER_REMOTE_USER = 'REMOTE_USER'
|
|
|
|
|
|
|
|
##########################################################################
|
|
|
|
# PSQL tool settings
|
|
|
|
##########################################################################
|
|
|
|
# This will enable PSQL tool in pgAdmin when running in server mode.
|
|
|
|
# PSQL is always enabled in Desktop mode, however in server mode it is
|
|
|
|
# disabled by default because users can run arbitrary commands on the
|
|
|
|
# server through it.
|
|
|
|
ENABLE_PSQL = True
|
2024-01-31 16:41:58 +01:00
|
|
|
|