Function dotenvy::from_read_override

source ·
pub fn from_read_override<R: Read>(reader: R) -> Result<()>
Expand description

Loads environment variables from io::Read, overriding existing environment variables.

This is useful for loading environment variables from IPC or the network.

Where multiple declarations for the same environment variable exist in your reader, the last one is applied.

If you want the existing environment to take precedence, or if you want to be able to override environment variables on the command line, then use from_read instead.

For regular files, use from_path_override or from_filename_override.

§Examples

use std::io::Read;
use std::os::unix::net::UnixStream;

let mut stream = UnixStream::connect("/some/socket")?;
dotenvy::from_read_override(stream)?;