Skip to content

Unable to escape $ in env values. #41

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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