From da5545ff57a681518025bdd6e4556bf23fde8ca4 Mon Sep 17 00:00:00 2001 From: Akshay Joshi Date: Mon, 13 Dec 2021 13:07:37 +0530 Subject: [PATCH] Added support to disable the auto-discovery of the database servers. Fixes #7039 --- docs/en_US/release_notes_6_3.rst | 1 + web/config.py | 8 ++++++++ web/pgadmin/__init__.py | 6 ++++++ 3 files changed, 15 insertions(+) diff --git a/docs/en_US/release_notes_6_3.rst b/docs/en_US/release_notes_6_3.rst index 431efc360..63910a54d 100644 --- a/docs/en_US/release_notes_6_3.rst +++ b/docs/en_US/release_notes_6_3.rst @@ -11,6 +11,7 @@ New features | `Issue #6543 `_ - Added support for Two-factor authentication for improving security. | `Issue #6872 `_ - Include GSSAPI support in the PostgreSQL libraries and utilities on macOS. +| `Issue #7039 `_ - Added support to disable the auto-discovery of the database servers. Housekeeping ************ diff --git a/web/config.py b/web/config.py index c0079762a..d155d347b 100644 --- a/web/config.py +++ b/web/config.py @@ -782,6 +782,14 @@ ENABLE_PSQL = False ########################################################################## ENABLE_BINARY_PATH_BROWSING = False +############################################################################# +# AUTO_DISCOVER_SERVERS setting is used to enable the pgAdmin to discover the +# database server automatically on the local machine. +# When it is set to False, pgAdmin will not discover servers installed on +# the local machine. +############################################################################# +AUTO_DISCOVER_SERVERS = True + ########################################################################## # Local config settings ########################################################################## diff --git a/web/pgadmin/__init__.py b/web/pgadmin/__init__.py index eabd7dc9c..45dbb7267 100644 --- a/web/pgadmin/__init__.py +++ b/web/pgadmin/__init__.py @@ -537,6 +537,12 @@ def create_app(app_name=None): ########################################################################## @user_logged_in.connect_via(app) def on_user_logged_in(sender, user): + + # If Auto Discover servers is turned off then return from the + # function. + if not config.AUTO_DISCOVER_SERVERS: + return + # Keep hold of the user ID user_id = user.id