| Crates.io | postgres_secrets |
| lib.rs | postgres_secrets |
| version | 1.0.0 |
| created_at | 2024-12-02 03:58:38.150981+00 |
| updated_at | 2024-12-02 03:58:38.150981+00 |
| description | Secure access to Postgres credentials. |
| homepage | https://github.com/MaxBondABE/postgres_secrets |
| repository | https://github.com/MaxBondABE/postgres_secrets |
| max_upload_size | |
| id | 1468204 |
| size | 77,635 |
postgres_secrets - Load Postgres credentials securelypostgres_secrets allows you to load credentials from a file in standard ways that
are compatible with the Postgres tooling ecosystem.
Currently, only the pgpass
format is supported. Support for connection service files
may be implemented in the future.
postgres_secrets uses the same pgpass format
as psql. This gives command-line users a seamless experience between psql and tools
written with postgres_secrets.postgres_secrets makes it easy to pass credentials
to a container using tools like Docker secrets.postgres cratelet pgpass = postgres_secrets::PgPass::load()?; // Looks for the pgpass file in it's default location
let creds = pgpass.query()
.hostname("example.com")?
.find()?
.unwrap();
let config: postgres::Config = creds.into();
let db = config.connect(tls)?;
postgres_secrets can be audited in an afternoon.libpq.
While unlikely, this could lead to bugs or confusing behavior
in some circumstances.libpq is more permissive than this implementation. libpq will
tolerate invalid escape sequences and extra columns. Because
this behavior could cause bugs and confusing behavior, this
implementation returns errors in these circumstances.libpq has special behavior when localhost is supplied as the
hostname. This library does not support this.libpq performs a permissions check on the pgpass file, and will
not open a file which is too permissive. This library does not
perform this check.The documentation is hosted on docs.rs.