Function dotenvy::from_read

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

Loads environment variables from io::Read.

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

If variables with the same names already exist in the environment, then their values will be preserved.

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

If you wish to ensure all variables are loaded from your reader, ignoring variables already existing in the environment, then use from_read_override instead.

For regular files, use from_path or from_filename.

§Examples

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

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