Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to use env variables with '.' in it's name (i.e. REDIS.PUBSUB.PORT) #84

Closed
flamewow opened this issue Oct 26, 2022 · 2 comments
Closed

Comments

@flamewow
Copy link
Contributor

currently, if I want to use a variable whose name contains "." (e.g. REDIS.PUBSUB.PORT) the lib is not working.

Should be as simple as changing regex to allow "."

  const matches = envValue.match(/(.?\${*[\w\.]*(?::-[\w/]*)?}*)/g) || []

  return matches.reduce(function (newEnv, match, index) {
    const parts = /(.?)\${*([\w\.]*(?::-[\w/]*)?)?}*/g.exec(match)
    if (!parts || parts.length === 0) {
      return newEnv
    }
@flamewow
Copy link
Contributor Author

the PR #93

@motdotla
Copy link
Owner

motdotla commented Feb 6, 2024

our position on variable names is:

For the sake of portability (and sanity), environment variable names must consist solely of letters, digits, and the underscore ( _ ) and must not begin with a digit. In regex-speak, the names must match the following pattern:

https://dotenvx.com/docs/env-file#variable-names

that said, i would like to hear from people who simply do not have control over these env variable names. if so, what service is setting them like that for you? i've never seen that before in the many hosting, db, and other 3rd party services I've used.

@motdotla motdotla closed this as completed Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants