dominictarr / rc

The non-configurable configuration loader for lazy people.
Other
1.02k stars 97 forks source link

Improved support for environment variables #35

Closed rbabayoff closed 9 years ago

rbabayoff commented 9 years ago

Hey,

The standard convention for environment variables is all upper case. In addition, environment variables don't support dashes. What I recommend is to take command line options and look for all upper case environment variables, replacing dashes with underscores, i.e.:

--phantmosjs-options -> MYAPP_PHANTOMJS_OPTIONS

Would you take a pull request for this?

dominictarr commented 9 years ago

it's just a convention, you can have lowercase environment variables.

What we have to target is the center of a venn diagram compromised of JSON, cli arguments, and envvars.

Maybe you could have envvars that mapped FOO_BAR to fooBar but I feel that is a little too prescriptive... So it's much simpler to use lowercase/camelCase enviroment variables.

rbabayoff commented 9 years ago

What about the dashes that env vars don't support?

dominictarr commented 9 years ago

@rbabayoff dashes are nice in cli args, but awkward in javascript. I think the best is to not use them, or if you really want to use hyphens in cli args, then map them to camel case with something like https://www.npmjs.org/package/to-camel-case

rbabayoff commented 9 years ago

OK, tks