Expand description
Connection string parsing with support for service file and a subset of psql environment variables.
Note: tokio-postgres 0.7.9 introduced a change
preventing PGUSER and service configuration to set connection user.
The release of tokio-postgres 0.7.10
fix this issue.
§Environment variables
PGSERVICE- Name of the postgres service used for connection params.PGSYSCONFDIR- Location of the service files.PGSERVICEFILE- Name of the service file.PGHOST- behaves the same as thehostconnection parameter.PGPORT- behaves the same as theportconnection parameter.PGDATABASE- behaves the same as thedbnameconnection parameter.PGUSER- behaves the same as the user connection parameter.PGOPTIONS- behaves the same as theoptionsparameter.PGAPPNAME- behaves the same as theapplication_nameconnection parameter.PGCONNECT_TIMEOUT- behaves the same as theconnect_timeoutconnection parameter.PGPASSFILE- Specifies the name of the file used to store password.
§Passfile support
Passfile is actually supported only on linux platform
§Example
use pg_client_config::load_config;
let config = load_config(Some("service=myservice")).unwrap();
println!("{config:#?}");§See also
Enums§
- Error
- Error while parsing service file or retrieving parameter from environment
Functions§
- load_
config - Load postgres connection configuration