| Crates.io | pg-client-config |
| lib.rs | pg-client-config |
| version | 0.1.2 |
| created_at | 2023-04-06 12:49:44.19546+00 |
| updated_at | 2023-08-26 19:53:56.637985+00 |
| description | Support for Postgres service configuration files and environment variables |
| homepage | https://github.com/3liz/pg-event-server/ |
| repository | https://github.com/3liz/pg-event-server/ |
| max_upload_size | |
| id | 832162 |
| size | 45,280 |
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.
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 the host connection parameter.PGPORT - behaves the same as the port connection parameter.PGDATABASE - behaves the same as the dbname connection parameter.PGUSER - behaves the same as the user connection parameter.PGOPTIONS - behaves the same as the options parameter.PGAPPNAME - behaves the same as the application_name connection parameter.PGCONNECT_TIMEOUT - behaves the same as the connect_timeout connection parameter.PGPASSFILE - Specifies the name of the file used to store password.Passfile is actually supported only on linux platform
use pg_client_config::load_config;
let config = load_config(Some("service=myservice")).unwrap();
println!("{config:#?}");