2015-02-25 17:06:00 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
2014-12-16 15:54:29 +00:00
|
|
|
##########################################################################
|
|
|
|
#
|
|
|
|
# pgAdmin 4 - PostgreSQL Tools
|
|
|
|
#
|
2016-01-18 14:48:14 +00:00
|
|
|
# Copyright (C) 2013 - 2016, The pgAdmin Development Team
|
2014-12-16 15:54:29 +00:00
|
|
|
# This software is released under the PostgreSQL Licence
|
|
|
|
#
|
2015-10-20 07:03:18 +00:00
|
|
|
# config.py - Core application configuration settings
|
2014-12-16 15:54:29 +00:00
|
|
|
#
|
|
|
|
##########################################################################
|
|
|
|
|
2015-01-22 15:56:23 +00:00
|
|
|
import os
|
2016-06-21 13:12:14 +00:00
|
|
|
from logging import *
|
2014-12-16 15:54:29 +00:00
|
|
|
|
2014-12-17 12:52:43 +00:00
|
|
|
##########################################################################
|
|
|
|
# Application settings
|
|
|
|
##########################################################################
|
|
|
|
|
|
|
|
# Name of the application to display in the UI
|
|
|
|
APP_NAME = 'pgAdmin 4'
|
2015-06-30 05:51:55 +00:00
|
|
|
APP_ICON = 'icon-postgres-alt'
|
2014-12-17 12:52:43 +00:00
|
|
|
|
2016-07-22 15:14:57 +00:00
|
|
|
##########################################################################
|
|
|
|
# Application settings
|
|
|
|
##########################################################################
|
|
|
|
|
|
|
|
# NOTE!!!
|
|
|
|
# If you change any of APP_RELEASE, APP_REVISION or APP_SUFFIX, then you
|
|
|
|
# must also change APP_VERSION_INT to match.
|
|
|
|
|
2014-12-17 12:52:43 +00:00
|
|
|
# Application version number components
|
2016-05-17 17:08:18 +00:00
|
|
|
APP_RELEASE = 1
|
2014-12-17 12:52:43 +00:00
|
|
|
APP_REVISION = 0
|
|
|
|
|
|
|
|
# Application version suffix, e.g. 'beta1', 'dev'. Usually an empty string
|
|
|
|
# for GA releases.
|
2016-09-26 15:16:13 +00:00
|
|
|
APP_SUFFIX = ''
|
2014-12-17 12:52:43 +00:00
|
|
|
|
2016-07-22 15:14:57 +00:00
|
|
|
# Numeric application version for upgrade checks. Should be in the format:
|
|
|
|
# [X]XYYZZ, where X is the release version, Y is the revision, with a leading
|
|
|
|
# zero if needed, and Z represents the suffix, with a leading zero if needed
|
2016-09-26 15:16:13 +00:00
|
|
|
APP_VERSION_INT = 10006
|
2016-07-22 15:14:57 +00:00
|
|
|
|
|
|
|
# DO NOT CHANGE!
|
|
|
|
# The application version string, constructed from the components
|
2016-09-26 15:16:13 +00:00
|
|
|
if not APP_SUFFIX:
|
|
|
|
APP_VERSION = '%s.%s' % (APP_RELEASE, APP_REVISION)
|
|
|
|
else:
|
|
|
|
APP_VERSION = '%s.%s-%s' % (APP_RELEASE, APP_REVISION, APP_SUFFIX)
|
2016-07-22 15:14:57 +00:00
|
|
|
|
2015-01-27 16:54:39 +00:00
|
|
|
# Copyright string for display in the app
|
2016-01-18 14:48:14 +00:00
|
|
|
APP_COPYRIGHT = 'Copyright 2013 - 2016, The pgAdmin Development Team'
|
2015-01-27 16:54:39 +00:00
|
|
|
|
2016-07-22 15:14:57 +00:00
|
|
|
##########################################################################
|
|
|
|
# Misc stuff
|
|
|
|
##########################################################################
|
|
|
|
|
2015-10-20 07:03:18 +00:00
|
|
|
# Path to the online help.
|
2015-02-23 10:51:47 +00:00
|
|
|
HELP_PATH = '../../../docs/en_US/_build/html/'
|
|
|
|
|
2015-02-25 17:06:00 +00:00
|
|
|
# Languages we support in the UI
|
|
|
|
LANGUAGES = {
|
2016-08-08 15:48:10 +00:00
|
|
|
'en': 'English'
|
2015-02-25 17:06:00 +00:00
|
|
|
}
|
|
|
|
|
2015-01-20 12:32:06 +00:00
|
|
|
# DO NOT CHANGE UNLESS YOU KNOW WHAT YOU ARE DOING!
|
|
|
|
# List of modules to skip when dynamically loading
|
2015-10-20 07:03:18 +00:00
|
|
|
MODULE_BLACKLIST = ['test']
|
2014-12-18 17:49:09 +00:00
|
|
|
|
2015-02-15 22:10:53 +00:00
|
|
|
# DO NOT CHANGE UNLESS YOU KNOW WHAT YOU ARE DOING!
|
|
|
|
# List of treeview browser nodes to skip when dynamically loading
|
2015-10-20 07:03:18 +00:00
|
|
|
NODE_BLACKLIST = []
|
2015-02-15 22:10:53 +00:00
|
|
|
|
2016-06-16 19:11:43 +00:00
|
|
|
# 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.
|
|
|
|
if os.name == 'nt':
|
|
|
|
DATA_DIR = os.path.realpath(os.getenv('APPDATA') + "/pgAdmin")
|
|
|
|
else:
|
|
|
|
DATA_DIR = os.path.realpath(os.path.expanduser('~/.pgadmin/'))
|
|
|
|
|
2014-12-16 17:14:48 +00:00
|
|
|
##########################################################################
|
|
|
|
# Log settings
|
|
|
|
##########################################################################
|
|
|
|
|
2014-12-16 17:37:53 +00:00
|
|
|
# Debug mode?
|
2014-12-18 17:49:09 +00:00
|
|
|
DEBUG = False
|
2014-12-16 17:37:53 +00:00
|
|
|
|
2014-12-16 15:54:29 +00:00
|
|
|
# Application log level - one of:
|
2015-10-20 07:03:18 +00:00
|
|
|
# CRITICAL 50
|
|
|
|
# ERROR 40
|
|
|
|
# WARNING 30
|
|
|
|
# SQL 25
|
|
|
|
# INFO 20
|
|
|
|
# DEBUG 10
|
|
|
|
# NOTSET 0
|
2014-12-16 17:14:48 +00:00
|
|
|
CONSOLE_LOG_LEVEL = WARNING
|
2014-12-18 17:49:09 +00:00
|
|
|
FILE_LOG_LEVEL = INFO
|
2014-12-16 17:14:48 +00:00
|
|
|
|
2015-10-20 07:03:18 +00:00
|
|
|
# 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'
|
2014-12-16 15:54:29 +00:00
|
|
|
|
|
|
|
# Log file name
|
2016-03-22 15:05:43 +00:00
|
|
|
LOG_FILE = os.path.join(
|
2016-06-16 19:11:43 +00:00
|
|
|
DATA_DIR,
|
2016-03-22 15:05:43 +00:00
|
|
|
'pgadmin4.log'
|
2016-06-21 13:21:06 +00:00
|
|
|
)
|
2014-12-16 17:14:48 +00:00
|
|
|
|
|
|
|
##########################################################################
|
|
|
|
# Server settings
|
|
|
|
##########################################################################
|
|
|
|
|
2015-01-26 15:20:28 +00:00
|
|
|
# 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!!
|
|
|
|
SERVER_MODE = True
|
|
|
|
|
|
|
|
# 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 = 'pgadmin4@pgadmin.org'
|
|
|
|
|
2016-05-06 14:25:52 +00:00
|
|
|
# This configuration otion 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 = 'localhost'
|
|
|
|
|
2014-12-16 17:14:48 +00:00
|
|
|
# The default port on which the app server will listen if not set in the
|
|
|
|
# environment by the runtime
|
|
|
|
DEFAULT_SERVER_PORT = 5050
|
2014-12-16 15:54:29 +00:00
|
|
|
|
2014-12-16 17:37:53 +00:00
|
|
|
# Enable CSRF protection?
|
|
|
|
CSRF_ENABLED = True
|
|
|
|
|
2015-10-20 07:03:18 +00:00
|
|
|
# Secret key for signing CSRF data. Override this in config_local.py if
|
2014-12-16 17:37:53 +00:00
|
|
|
# running on a web server
|
2015-01-22 15:56:23 +00:00
|
|
|
CSRF_SESSION_KEY = 'SuperSecret1'
|
2014-12-16 17:37:53 +00:00
|
|
|
|
2015-10-20 07:03:18 +00:00
|
|
|
# Secret key for signing cookies. Override this in config_local.py if
|
2014-12-16 17:37:53 +00:00
|
|
|
# running on a web server
|
2015-01-22 15:56:23 +00:00
|
|
|
SECRET_KEY = 'SuperSecret2'
|
|
|
|
|
|
|
|
# Salt used when hashing passwords. Override this in config_local.py if
|
|
|
|
# running on a web server
|
|
|
|
SECURITY_PASSWORD_SALT = 'SuperSecret3'
|
|
|
|
|
|
|
|
# Hashing algorithm used for password storage
|
|
|
|
SECURITY_PASSWORD_HASH = 'pbkdf2_sha512'
|
|
|
|
|
2015-02-12 10:28:15 +00:00
|
|
|
# Should HTML be minified on the fly when not in debug mode?
|
2016-08-18 12:43:00 +00:00
|
|
|
# Note: This is disabled by default as it will error when processing the
|
|
|
|
# docs. If the serving of docs is handled by an Apache HTTPD
|
|
|
|
# instance (rather than via the app), then it can be safely enabled.
|
|
|
|
MINIFY_HTML = False
|
2015-02-12 10:28:15 +00:00
|
|
|
|
2015-10-22 06:19:53 +00:00
|
|
|
##########################################################################
|
|
|
|
# Server Connection Driver Settings
|
|
|
|
##########################################################################
|
|
|
|
|
|
|
|
# The default driver used for making connection with PostgreSQL
|
|
|
|
PG_DEFAULT_DRIVER = 'psycopg2'
|
|
|
|
|
|
|
|
# Maximum allowed idle time in minutes before which releasing the connection
|
|
|
|
# for the particular session. (in minutes)
|
|
|
|
MAX_SESSION_IDLE_TIME = 60
|
|
|
|
|
2015-01-22 15:56:23 +00:00
|
|
|
##########################################################################
|
|
|
|
# User account and settings storage
|
|
|
|
##########################################################################
|
|
|
|
|
|
|
|
# The default path to the SQLite database used to store user accounts and
|
|
|
|
# settings. This default places the file in the same directory as this
|
|
|
|
# config file, but generates an absolute path for use througout the app.
|
2015-10-20 07:03:18 +00:00
|
|
|
SQLITE_PATH = os.path.join(
|
2016-06-16 19:11:43 +00:00
|
|
|
DATA_DIR,
|
2016-03-22 15:05:43 +00:00
|
|
|
'pgadmin4.db'
|
2016-06-21 13:21:06 +00:00
|
|
|
)
|
2016-05-10 10:28:59 +00:00
|
|
|
# SQLITE_TIMEOUT will define how long to wait before throwing the error -
|
2016-06-20 10:23:24 +00:00
|
|
|
# OperationError due to database lock. On slower system, you may need to change
|
|
|
|
# this to some higher value.
|
2016-05-10 10:28:59 +00:00
|
|
|
# (Default: 500 milliseconds)
|
|
|
|
SQLITE_TIMEOUT = 500
|
2016-03-22 15:05:43 +00:00
|
|
|
|
|
|
|
##########################################################################
|
|
|
|
# Server-side session storage path
|
|
|
|
#
|
|
|
|
# SESSION_DB_PATH (Default: $HOME/.pgadmin4/sessions)
|
|
|
|
##########################################################################
|
|
|
|
#
|
|
|
|
# We use SQLite for server-side session storage. There will be one
|
|
|
|
# SQLite database object per session created.
|
|
|
|
#
|
|
|
|
# Specify the path used to store your session objects.
|
|
|
|
#
|
|
|
|
# If the specified directory does not exist, the setup script will create
|
|
|
|
# it with permission mode 700 to keep the session database secure.
|
|
|
|
#
|
|
|
|
# On certain systems, you can use shared memory (tmpfs) for maximum
|
|
|
|
# scalability, for example, on Ubuntu:
|
|
|
|
#
|
|
|
|
# SESSION_DB_PATH = '/run/shm/pgAdmin4_session'
|
|
|
|
#
|
|
|
|
##########################################################################
|
|
|
|
SESSION_DB_PATH = os.path.join(
|
2016-06-16 19:11:43 +00:00
|
|
|
DATA_DIR,
|
2016-03-22 15:05:43 +00:00
|
|
|
'sessions'
|
2016-06-21 13:21:06 +00:00
|
|
|
)
|
2015-01-22 15:56:23 +00:00
|
|
|
|
2016-05-08 18:34:25 +00:00
|
|
|
SESSION_COOKIE_NAME = 'pga4_session'
|
|
|
|
|
2015-01-22 15:56:23 +00:00
|
|
|
##########################################################################
|
|
|
|
# Mail server settings
|
|
|
|
##########################################################################
|
|
|
|
|
|
|
|
# These settings are used when running in web server mode for confirming
|
|
|
|
# and resetting passwords etc.
|
2016-08-23 10:41:31 +00:00
|
|
|
# See: http://pythonhosted.org/Flask-Mail/ for more info
|
|
|
|
MAIL_SERVER = 'localhost'
|
|
|
|
MAIL_PORT = 25
|
|
|
|
MAIL_USE_SSL = False
|
|
|
|
MAIL_USE_TLS = False
|
|
|
|
MAIL_USERNAME = ''
|
|
|
|
MAIL_PASSWORD = ''
|
|
|
|
MAIL_DEBUG = False
|
2015-01-22 15:56:23 +00:00
|
|
|
|
|
|
|
##########################################################################
|
|
|
|
# Mail content settings
|
|
|
|
##########################################################################
|
|
|
|
|
|
|
|
# These settings define the content of password reset emails
|
2015-10-20 07:03:18 +00:00
|
|
|
SECURITY_EMAIL_SUBJECT_PASSWORD_RESET = "Password reset instructions for %s" \
|
2016-06-21 13:21:06 +00:00
|
|
|
% APP_NAME
|
2015-10-20 07:03:18 +00:00
|
|
|
SECURITY_EMAIL_SUBJECT_PASSWORD_NOTICE = "Your %s password has been reset" \
|
2016-06-21 13:21:06 +00:00
|
|
|
% APP_NAME
|
2015-10-20 07:03:18 +00:00
|
|
|
SECURITY_EMAIL_SUBJECT_PASSWORD_CHANGE_NOTICE = \
|
2016-06-21 13:21:06 +00:00
|
|
|
"Your password for %s has been changed" % APP_NAME
|
2014-12-16 17:37:53 +00:00
|
|
|
|
2016-02-08 16:28:20 +00:00
|
|
|
##########################################################################
|
|
|
|
# Upgrade checks
|
|
|
|
##########################################################################
|
|
|
|
|
|
|
|
# Check for new versions of the application?
|
|
|
|
UPGRADE_CHECK_ENABLED = True
|
|
|
|
|
|
|
|
# Where should we get the data from?
|
2016-05-21 17:54:12 +00:00
|
|
|
UPGRADE_CHECK_URL = 'https://www.pgadmin.org/versions.json'
|
2016-02-08 16:28:20 +00:00
|
|
|
|
2016-05-12 18:34:28 +00:00
|
|
|
##########################################################################
|
|
|
|
# Storage Manager storage url config settings
|
|
|
|
# If user sets STORAGE_DIR to empty it will show all volumes if platform
|
|
|
|
# is Windows, '/' if it is Linux, Mac or any other unix type system.
|
|
|
|
|
|
|
|
# For example:
|
|
|
|
# 1. STORAGE_DIR = get_drive("C") or get_drive() # return C:/ by default
|
|
|
|
# where C can be any drive character such as "D", "E", "G" etc
|
|
|
|
# 2. Set path manually like
|
|
|
|
# STORAGE_DIR = "/path/to/directory/"
|
|
|
|
##########################################################################
|
|
|
|
STORAGE_DIR = os.path.join(
|
2016-06-16 19:11:43 +00:00
|
|
|
DATA_DIR,
|
2016-05-12 18:34:28 +00:00
|
|
|
'storage'
|
2016-06-21 13:21:06 +00:00
|
|
|
)
|
2016-05-12 18:34:28 +00:00
|
|
|
|
2016-09-14 15:26:12 +00:00
|
|
|
##########################################################################
|
|
|
|
# Test settings - used primarily by the regression suite, not for users
|
|
|
|
##########################################################################
|
|
|
|
# Set default testing mode
|
|
|
|
TESTING_MODE = False
|
|
|
|
|
|
|
|
# The default path for SQLite database for testing
|
|
|
|
TEST_SQLITE_PATH = os.path.join(DATA_DIR, 'test_pgadmin4.db')
|
|
|
|
|
2016-06-02 09:21:32 +00:00
|
|
|
##########################################################################
|
|
|
|
# Allows flask application to response to the each request asynchronously
|
|
|
|
##########################################################################
|
|
|
|
THREADED_MODE = True
|
|
|
|
|
2016-07-26 12:01:56 +00:00
|
|
|
##########################################################################
|
|
|
|
# Do not allow SQLALCHEMY to track modification as it is going to be
|
|
|
|
# deprecated in future
|
|
|
|
##########################################################################
|
|
|
|
SQLALCHEMY_TRACK_MODIFICATIONS = False
|
|
|
|
|
2014-12-16 17:14:48 +00:00
|
|
|
##########################################################################
|
|
|
|
# Local config settings
|
|
|
|
##########################################################################
|
2014-12-16 15:54:29 +00:00
|
|
|
|
2016-06-15 19:56:27 +00:00
|
|
|
# Load distribution-specific config overrides
|
|
|
|
try:
|
|
|
|
from config_distro import *
|
|
|
|
except ImportError:
|
|
|
|
pass
|
|
|
|
|
2014-12-16 15:54:29 +00:00
|
|
|
# Load local config overrides
|
|
|
|
try:
|
|
|
|
from config_local import *
|
|
|
|
except ImportError:
|
|
|
|
pass
|