diff --git a/README.rst b/README.rst index 0668dd0..f641464 100644 --- a/README.rst +++ b/README.rst @@ -69,7 +69,7 @@ By default, pg_view tries to autodetect all PostgreSQL clusters running on the s - checks all arguments, picking the first that allows it to establish a connection - if pg_view can't get either the port/host or port/socket_directory pair, bail out -If the program can't detect your connection arguments using the algorithm above, you can specify those arguments manually using the configuration file supplied with the -c option. This file should consist of one or more sections, each containing a key = value pair. +If the program can't detect your connection arguments using the algorithm above, you can specify those arguments manually using the configuration file supplied with the -c option. This file should consist of one or more sections, each containing a key = value pair. You can also use your Connection Service File. The title of each section represents a database cluster name (this name is for display purposes only). The dbname parameter is `postgres` by default, and specifies the actual name of the database to connect to. The key-value pairs should contain connection parameters. diff --git a/pg_view/__init__.py b/pg_view/__init__.py index cd9eb47..bb76d0f 100644 --- a/pg_view/__init__.py +++ b/pg_view/__init__.py @@ -204,6 +204,9 @@ def main(): if not establish_user_defined_connection(instance, conn, clusters): logger.error('failed to acquire details about ' + 'the database cluster {0}, the server will be skipped'.format(instance)) + elif options.instance: + if not establish_user_defined_connection(options.instance, {'service': options.instance}, clusters): + logger.error("unable to continue with cluster {0}".format(options.instance)) elif options.host: # try to connet to the database specified by command-line options conn = build_connection(options.host, options.port, options.username, options.dbname)