allow to use host database connection parameter

Add config option:
db_host (default empty) - name of host to connect to
This commit is contained in:
2022-04-28 06:12:44 +02:00
parent 98c1e8daad
commit c6c50a5d23
6 changed files with 51 additions and 16 deletions

View File

@@ -204,12 +204,37 @@ public:
// the database connection string
// https://www.postgresql.org/docs/14/libpq-connect.html#LIBPQ-CONNSTRING
// default: empty (not used if empty)
// default: empty
// if empty then winix uses db_host and db_hostaddr
std::wstring db_conn_string;
// the database host ip address and port number
// default: empty which means winix connects to a Unix-domain socket
// the database host name used if db_conn_string is empty
// default: empty
std::wstring db_host;
// the database host ip address used if db_conn_string is empty
// default: empty
// if db_host is empty and db_hostaddr is empty then winix connects to a Unix-domain socket
// meaning of db_host and db_hostaddr parameters is the same as described in
// https://www.postgresql.org/docs/14/libpq-connect.html#LIBPQ-CONNSTRING
//
// from above documentation:
// Using hostaddr allows the application to avoid a host name look-up, which might be important
// in applications with time constraints. However, a host name is required for GSSAPI or SSPI
// authentication methods, as well as for verify-full SSL certificate verification.
// The following rules are used:
//
// - If host is specified without hostaddr, a host name lookup occurs.
//
// - If hostaddr is specified without host, the value for hostaddr gives the server network address.
// The connection attempt will fail if the authentication method requires a host name.
//
// - If both host and hostaddr are specified, the value for hostaddr gives the server network address.
// The value for host is ignored unless the authentication method requires it, in which case it will
// be used as the host name.
std::wstring db_hostaddr;
// the database port number
std::wstring db_port;
// the database name, user name and a password for the PostgreSQL database