Skip to content

Unable to escape $ in env values. #41

@revanth0212

Description

@revanth0212

For instance, if we have a key-value pair that has $ in the value, the envsub parser is not giving us an option to escape the $ value.

For instance,

const parseEnv = require("envsub/js/envsub-parser");

const envParserConfig = {
  outputFile: null,
  options: {
    all: false,
    diff: false,
    protect: false,
    syntax: "dollar-both",
  },
  cli: false,
};

const data = {
  name: "this_is_a_value_\${PATH}",
};

const content = parseEnv(JSON.stringify(data), envParserConfig);

console.log(content); // "{\"name\":\"this_is_a_value_/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\"}"

Instead of the value being this_is_a_value_\${PATH} it is "{\"name\":\"this_is_a_value_/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\"}" instead.

Related runkit: https://runkit.com/embed/490p8grnbrld

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions