database

Database connection settings (URL or individual components).

struct Settings

source

pub struct Settings

Database connection settings from the [database] configuration table.

Connection details can be provided either as a complete URL or as individual components (scheme, host, port, username, password). When both a URL and individual components are present, the explicit URL takes precedence.

Field Type Description
auth_token Option<String> Bearer or API token for database authentication.
host Option<String> Database server hostname or IP address.
password Option<String> Password for username/password authentication.
port Option<u16> Port number the database server listens on.
scheme Option<String> Connection scheme (e.g. sqlite, postgres). Defaults to sqlite when building a URL from components.
url Option<String> Explicit connection URL. When set, component fields are ignored by Settings::url.
username Option<String> Username for database authentication.

Implements Clone, Debug, Default, Deserialize<'de>, PartialEq, Serialize.

Settings::auth_token

source

pub fn auth_token(&self) -> &Option<String>

Bearer or API token for database authentication.

Parameter Type Description
returns &Option<String>

Settings::host

source

pub fn host(&self) -> &Option<String>

Database server hostname or IP address.

Parameter Type Description
returns &Option<String>

Settings::password

source

pub fn password(&self) -> &Option<String>

Password for username/password authentication.

Parameter Type Description
returns &Option<String>

Settings::port

source

pub fn port(&self) -> &Option<u16>

Port number the database server listens on.

Parameter Type Description
returns &Option<u16>

Settings::scheme

source

pub fn scheme(&self) -> &Option<String>

Connection scheme (e.g. sqlite, postgres). Defaults to sqlite when building a URL from components.

Parameter Type Description
returns &Option<String>

Settings::username

source

pub fn username(&self) -> &Option<String>

Username for database authentication.

Parameter Type Description
returns &Option<String>

Settings::url

source

pub fn url(&self) -> Option<String>

Returns the database connection URL.

If an explicit url was configured, it is returned as-is. Otherwise a URL is assembled from the individual component fields in the form scheme://[user[:pass]@]host[:port].

Parameter Type Description
returns Option<String> The connection URL. Returns None when no url or host is configured.