Crates.io | postgres-service |
lib.rs | postgres-service |
version | 0.19.4 |
source | src |
created_at | 2017-04-21 19:59:32.169216 |
updated_at | 2024-02-20 18:01:13.453402 |
description | Parse Postgres service configuration files |
homepage | |
repository | https://github.com/njaard/postgres-service |
max_upload_size | |
id | 11460 |
size | 6,446 |
If you use postgres's service feature for configuring your connections, then this is the library for you.
This is for use with the Postgres crate.
~/.pg_service.conf
, $PGSYSCONFDIR/pg_service.conf
, and /etc/postgresql-common/pg_service.conf
This example uses the service name mydb
and overrides
the user
value, then makes the connection.
let conn = postgres_service::load_connect_params("mydb")
.expect("unable to find configuration")
.user("your_user_name")
.connect(postgres::NoTls)
.expect("unable to connect");