Skip to main content

replace

Function replace 

Source
pub fn replace<T: AsRef<str>>(
    input: &str,
    variables: &HashMap<String, T>,
) -> String
Expand description

This is a simple templating engine for replacing variables in a YAML file with environment variables and other custom variables.

This is intended for use on supervisor config and unit files, but it works on the whole file as a big string and could theoretically be used for anything.

Given a text like “value: ${{FOO}}”, this will replace the ${{FOO}} portion with the FOO value in the given variables HashMap.

If any variables are unrecognized, they will be left unmodified.