mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2026-09-03 20:52:57 -05:00
Support configuration files that are external to the application installation. Fixes #5235
This commit is contained in:
@@ -29,9 +29,10 @@ Configuration
|
|||||||
|
|
||||||
The core application configuration is found in **config.py**. This file includes
|
The core application configuration is found in **config.py**. This file includes
|
||||||
all configurable settings for the application, along with descriptions of their
|
all configurable settings for the application, along with descriptions of their
|
||||||
use. It is essential that various settings are configured prior to deployent on
|
use. It is essential that various settings are configured prior to deployment on
|
||||||
a web server; these can be overriden in **config_local.py** to avoid modifying
|
a web server; these can be overridden in **config_local.py** or
|
||||||
the main configuration file.
|
**config_system.py** (see the :ref:`config.py <config_py>` documentation) to
|
||||||
|
avoid modifying the main configuration file.
|
||||||
|
|
||||||
User Settings
|
User Settings
|
||||||
=============
|
=============
|
||||||
@@ -108,7 +109,7 @@ PgAdminModule class. This is responsible for providing hook points to integrate
|
|||||||
the module into the rest of the application - for example, a hook might tell
|
the module into the rest of the application - for example, a hook might tell
|
||||||
the caller what CSS files need to be included on the rendered page, or what menu
|
the caller what CSS files need to be included on the rendered page, or what menu
|
||||||
options to include and what they should do. Hook points need not exist if they
|
options to include and what they should do. Hook points need not exist if they
|
||||||
are not required. It is the responsiblity of the caller to ensure they are
|
are not required. It is the responsibility of the caller to ensure they are
|
||||||
present before attempting to utilise them.
|
present before attempting to utilise them.
|
||||||
|
|
||||||
Hooks currently implemented are:
|
Hooks currently implemented are:
|
||||||
@@ -210,6 +211,6 @@ bootstrap for UI look and feel, Backbone for data manipulation of a node,
|
|||||||
Backform for generating properties/create dialog for selected node. We have
|
Backform for generating properties/create dialog for selected node. We have
|
||||||
divided each module in small chunks as much as possible. Not all javascript
|
divided each module in small chunks as much as possible. Not all javascript
|
||||||
modules are required to be loaded (i.e. loading a javascript module for
|
modules are required to be loaded (i.e. loading a javascript module for
|
||||||
database will make sense only when a server node is loaded competely.) Please
|
database will make sense only when a server node is loaded completely.) Please
|
||||||
look at the the javascript files node.js, browser.js, menu.js, panel.js, etc for
|
look at the the javascript files node.js, browser.js, menu.js, panel.js, etc for
|
||||||
better understanding of the code.
|
better understanding of the code.
|
||||||
@@ -23,10 +23,21 @@ are as follows:
|
|||||||
and may be created by users in the same directory as ``config.py`` if
|
and may be created by users in the same directory as ``config.py`` if
|
||||||
needed.
|
needed.
|
||||||
|
|
||||||
.. note:: If the SERVER_MODE setting is changed in ``config_distro.py`` or ``config_local.py``,
|
* ``config_system.py``: This file is read after ``config_local.py`` and is
|
||||||
you will most likely need to re-set the LOG_FILE, SQLITE_PATH, SESSION_DB_PATH
|
intended for system administrators to include settings that are configured
|
||||||
and STORAGE_DIR values as well as they will have been set based on the default
|
system-wide from a secure location that users cannot normally modify and that
|
||||||
configuration or overridden by the runtime.
|
is outside of the pgAdmin installation. The location for this file varies
|
||||||
|
based on the platform, and only needs to be created if desired:
|
||||||
|
|
||||||
|
* Linux: ``/etc/pgadmin/config_system.py``
|
||||||
|
* macOS: ``/Library/Preferences/pgadmin/config_system.py``
|
||||||
|
* Windows: ``%CommonProgramFiles%\pgadmin\config_system.py``
|
||||||
|
|
||||||
|
.. note:: If the SERVER_MODE setting is changed in ``config_distro.py``,
|
||||||
|
``config_local.py``, or ``config_system.py`` you will most likely need to
|
||||||
|
re-set the LOG_FILE, SQLITE_PATH, SESSION_DB_PATH and STORAGE_DIR values
|
||||||
|
as well as they will have been set based on the default configuration or
|
||||||
|
overridden by the runtime.
|
||||||
|
|
||||||
The default ``config.py`` file is shown below for reference:
|
The default ``config.py`` file is shown below for reference:
|
||||||
|
|
||||||
|
|||||||
@@ -5,9 +5,10 @@
|
|||||||
**************************************************
|
**************************************************
|
||||||
|
|
||||||
To enable LDAP authentication for pgAdmin, you must configure the LDAP
|
To enable LDAP authentication for pgAdmin, you must configure the LDAP
|
||||||
settings in the *config_local.py* or *config_distro.py* file on the system where
|
settings in the *config_local.py* or *config_system.py* file (see the
|
||||||
pgAdmin is installed in Server mode. You can copy these settings from *config.py*
|
:ref:`config.py <config_py>` documentation) on the system where pgAdmin is
|
||||||
file and modify the values for the following parameters:
|
installed in Server mode. You can copy these settings from *config.py* file
|
||||||
|
and modify the values for the following parameters:
|
||||||
|
|
||||||
.. csv-table::
|
.. csv-table::
|
||||||
:header: "**Parameter**", "**Description**"
|
:header: "**Parameter**", "**Description**"
|
||||||
@@ -21,9 +22,12 @@ file and modify the values for the following parameters:
|
|||||||
* [‘ldap’]: pgAdmin will use only LDAP authentication.
|
* [‘ldap’]: pgAdmin will use only LDAP authentication.
|
||||||
|
|
||||||
* [‘ldap’, ‘internal’]: pgAdmin will first try to authenticate the user through
|
* [‘ldap’, ‘internal’]: pgAdmin will first try to authenticate the user through
|
||||||
LDAP. If that authentication fails, then internal user entries of pgAdmin will be used for authentication.
|
LDAP. If that authentication fails, then internal user entries of pgAdmin
|
||||||
|
will be used for authentication.
|
||||||
|
|
||||||
* [‘internal’, ‘ldap’]: pgAdmin will first try to authenticate the user through internal user entries. If that authentication fails, then LDAP authentication will be used."
|
* [‘internal’, ‘ldap’]: pgAdmin will first try to authenticate the user
|
||||||
|
through internal user entries. If that authentication fails, then LDAP
|
||||||
|
authentication will be used."
|
||||||
"LDAP_AUTO_CREATE_USER", "Specifies if you want to automatically create a pgAdmin
|
"LDAP_AUTO_CREATE_USER", "Specifies if you want to automatically create a pgAdmin
|
||||||
user corresponding to the LDAP user credentials. Please note that LDAP password
|
user corresponding to the LDAP user credentials. Please note that LDAP password
|
||||||
is not stored in the pgAdmin database."
|
is not stored in the pgAdmin database."
|
||||||
|
|||||||
@@ -286,8 +286,10 @@ the *Clear* drop-down menu.
|
|||||||
Query History is maintained across sessions for each database on a per-user
|
Query History is maintained across sessions for each database on a per-user
|
||||||
basis when running in Query Tool mode. In View/Edit Data mode, history is not
|
basis when running in Query Tool mode. In View/Edit Data mode, history is not
|
||||||
retained. By default, the last 20 queries are stored for each database. This
|
retained. By default, the last 20 queries are stored for each database. This
|
||||||
can be adjusted in `config_local.py` by overriding the `MAX_QUERY_HIST_STORED`
|
can be adjusted in ``config_local.py`` or ``config_system.py`` (see the
|
||||||
value. See the :ref:`Deployment <deployment>` section for more information.
|
:ref:`config.py <config_py>` documentation) by overriding the
|
||||||
|
`MAX_QUERY_HIST_STORED` value. See the :ref:`Deployment <deployment>` section
|
||||||
|
for more information.
|
||||||
|
|
||||||
Connection Status
|
Connection Status
|
||||||
*****************
|
*****************
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ This release contains a number of bug fixes and new features since the release o
|
|||||||
New features
|
New features
|
||||||
************
|
************
|
||||||
|
|
||||||
|
| `Issue #5235 <https://redmine.postgresql.org/issues/5235>`_ - Support configuration files that are external to the application installation.
|
||||||
| `Issue #5484 <https://redmine.postgresql.org/issues/5484>`_ - Added support for LDAP authentication with different DN by setting the dedicated user for the LDAP connection.
|
| `Issue #5484 <https://redmine.postgresql.org/issues/5484>`_ - Added support for LDAP authentication with different DN by setting the dedicated user for the LDAP connection.
|
||||||
| `Issue #5583 <https://redmine.postgresql.org/issues/5583>`_ - Added support for schema level restriction.
|
| `Issue #5583 <https://redmine.postgresql.org/issues/5583>`_ - Added support for schema level restriction.
|
||||||
| `Issue #5601 <https://redmine.postgresql.org/issues/5601>`_ - Added RLS Policy support in Schema Diff.
|
| `Issue #5601 <https://redmine.postgresql.org/issues/5601>`_ - Added RLS Policy support in Schema Diff.
|
||||||
|
|||||||
+17
-2
@@ -16,7 +16,6 @@ import logging
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
# We need to include the root directory in sys.path to ensure that we can
|
# 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.
|
# find everything we need when running in the standalone runtime.
|
||||||
root = os.path.dirname(os.path.realpath(__file__))
|
root = os.path.dirname(os.path.realpath(__file__))
|
||||||
@@ -572,7 +571,23 @@ try:
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# Override DEFAULT_SERVE value from environment variable.
|
# Load system config overrides. We do this last, so that the sysadmin can
|
||||||
|
# override anything they want from a config file that's in a protected system
|
||||||
|
# directory and away from pgAdmin to avoid invalidating signatures.
|
||||||
|
system_config_dir = '/etc/pgadmin'
|
||||||
|
if sys.platform.startswith('win32'):
|
||||||
|
system_config_dir = os.environ['CommonProgramFiles'] + '/pgadmin'
|
||||||
|
elif sys.platform.startswith('darwin'):
|
||||||
|
system_config_dir = '/Library/Preferences/pgadmin'
|
||||||
|
|
||||||
|
if os.path.exists(system_config_dir + '/config_system.py'):
|
||||||
|
try:
|
||||||
|
sys.path.insert(0, system_config_dir)
|
||||||
|
from config_system import *
|
||||||
|
except ImportError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
# Override DEFAULT_SERVER value from environment variable.
|
||||||
if 'PGADMIN_CONFIG_DEFAULT_SERVER' in os.environ:
|
if 'PGADMIN_CONFIG_DEFAULT_SERVER' in os.environ:
|
||||||
DEFAULT_SERVER = os.environ['PGADMIN_CONFIG_DEFAULT_SERVER']
|
DEFAULT_SERVER = os.environ['PGADMIN_CONFIG_DEFAULT_SERVER']
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user