entropitor/dotenv-cli

Setting variable does not work when value has dash

Closed this issue ยท 11 comments

For instance, setting dotenv -v AWS_REGION=eu-west-1 gives you an error of Unexpected argument AWS_REGION=eu-west-1. Expected variable in format variable=value

Suffering from the same issue :( any workarounds or fixes?

Using dotenv-cli v3.2.0 seems to fix this issue.

Another workaround is intercepting the dotenv cli command with cross-env to manually pass additional command line arguments
e.g.

dotenv -- cross-env NODE_OPTIONS='--inspect' next dev

We can improve this regex https://github.com/entropitor/dotenv-cli/blob/master/cli.js#L50

This is because of this security issue: #57 (comment)

Feel free to create a PR to fix this

I think the same bug applies here ( or it might be a different bug ๐Ÿค”๐Ÿค”๐Ÿค”)

Input:

image

Output:

image

yeah but } shouldn't be part of the default value :/

image
that's from https://www.npmjs.com/package/dotenv-expand

p.s. not sure if it's a bug for this package or dotenv-expand

That's probably in dotenv-expand. This package is just a simple wrapper around that one...

motdotla/dotenv-expand#70
yeah... it's a bug there, thanks.

Had a crack at a PR #69