Skip to main content

connect_nats_from_env

Function connect_nats_from_env 

Source
pub(crate) async fn connect_nats_from_env() -> Result<Client>
Expand description

Connects to NATS using the standard credentials and server environment.

Loads the credentials file named by NATS_CREDS_FILE (default apt.creds) and connects to the servers listed in NATS_SERVERS (see nats_config::servers_from_env).

ยงErrors

Returns an error if the credentials file cannot be loaded, if NATS_SERVERS is invalid or empty, or if the connection fails.