Skip to content

Substitution always reads from the environment #150

@allan2

Description

@allan2

Substitution is always using the environment even when loading is set to ignore the environment.

let s = "FOO=def\nFOO_SUBBED=${FOO}123";
let cursor = Cursor::new(s.as_bytes());
let env_map = EnvLoader::with_reader(cursor)
    .sequence(EnvSequence::InputOnly)
    .load()?;
for (k, v) in env_map.iter() {
    println!("{}: {}", k, v);
}

When run with FOO=abc in the environment, the output is

FOO: def
FOO_SUBBED: abc123

This issue is due to the use of env::var in apply_subtitution. Parsing does not take into account that the environment may be ignored in the new API.

#149 related

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions