pub struct Config {Show 15 fields
pub host: String,
pub port: u16,
pub user: String,
pub password: Option<String>,
pub database: Option<String>,
pub application_name: Option<String>,
pub options: Option<String>,
pub sslmode: SslMode,
pub sslrootcert: Option<String>,
pub connect_timeout: Duration,
pub timezone: Option<String>,
pub statement_cache_size: usize,
pub max_message_len: usize,
pub max_scram_iterations: u32,
pub pool: PoolConfig,
}Expand description
A parsed postgres:// connection URL.
Fields§
§host: StringHost name or IP address.
port: u16TCP port.
user: StringUser name.
password: Option<String>Password, if any.
database: Option<String>Database name, if any.
application_name: Option<String>application_name reported to the server.
options: Option<String>Extra options passed to the server.
sslmode: SslModeTLS mode.
sslrootcert: Option<String>Path to a PEM file of trusted root certificates.
connect_timeout: DurationTimeout applied to establishing a connection.
timezone: Option<String>IANA time zone used to interpret zone-less timestamp, date and
time values. Defaults to UTC.
statement_cache_size: usizeMaximum number of prepared statements cached per connection (0
disables caching, for transaction-mode poolers).
max_message_len: usizeLargest accepted backend message, in bytes. Defaults to 128 MiB. A hostile server cannot make the client buffer more than this per message.
max_scram_iterations: u32Largest SCRAM iteration count accepted from the server. Defaults to 2,000,000. The server chooses this value and it is pure client CPU work, so it bounds the work an unauthenticated server can force.
pool: PoolConfigPool settings parsed from the URL (overridden by an explicit
PoolConfig).
Implementations§
Source§impl Config
impl Config
Sourcepub fn parse(url: &str) -> Result<Self, Error>
pub fn parse(url: &str) -> Result<Self, Error>
Parses a postgres:// or postgresql:// URL.
Supported query parameters: sslmode, sslrootcert, connect_timeout
(seconds), application_name, options, timezone,
statement_cache_size, max_message_len (bytes),
max_scram_iterations, pool_size, min_connections,
acquire_timeout, idle_timeout and max_lifetime. Unknown
parameters are rejected so that typos surface immediately.
§Errors
Returns Error::Config for a malformed URL, a missing user, or an
unsupported parameter.