yargs / yargs/yargs-parser

Nested environment variables are being lowercased (regression?)

Open
#356 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
JavaScript
Stars
519
Forks
129
Avg merge
1h 34m
Merged PRs (30d)
1

Description

In v15.4.1, when passing in nested environment variables, the case of the nested fields would remain how they were defined.

e.g.

const argv = yargs.env('CONFIG')....

and defining an environment variable like CONFIG_some__nested__camelCase__id=foo.

In v15.4.1 this would parse as {some: {nested: {camelCase: {id: 'foo'}}}}

In the latest 16.2 release, I am seeing: {some: {nested: {camelcase: {id: 'foo'}}}}

Note the camelCase field is now lowercased.

I can provide a repro example, but wanted to get the issue out here, in case this was already known (either as a regression or as new behavior). Thanks!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the yargs.env nested environment-variable parsing described in the issue and compare the v15.4.1 and 16.2 behavior for CONFIG_some__nested__camelCase__id=foo. Done means nested field names preserve their defined casing, with regression coverage for the reported example.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.