{"action":"created","issue":{"url":"https://api.github.com/repos/lorenwest/node-config/issues/276","labels_url":"https://api.github.com/repos/lorenwest/node-config/issues/276/labels{/name}","comments_url":"https://api.github.com/repos/lorenwest/node-config/issues/276/comments","events_url":"https://api.github.com/repos/lorenwest/node-config/issues/276/events","html_url":"https://github.com/lorenwest/node-config/issues/276","id":122137752,"number":276,"title":"Add env var to search additional config directories in order to override values found in $NODE_CONFIG_DIR","user":{"login":"matthewadams","id":449952,"avatar_url":"https://avatars.githubusercontent.com/u/449952?v=3","gravatar_id":"","url":"https://api.github.com/users/matthewadams","html_url":"https://github.com/matthewadams","followers_url":"https://api.github.com/users/matthewadams/followers","following_url":"https://api.github.com/users/matthewadams/following{/other_user}","gists_url":"https://api.github.com/users/matthewadams/gists{/gist_id}","starred_url":"https://api.github.com/users/matthewadams/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matthewadams/subscriptions","organizations_url":"https://api.github.com/users/matthewadams/orgs","repos_url":"https://api.github.com/users/matthewadams/repos","events_url":"https://api.github.com/users/matthewadams/events{/privacy}","received_events_url":"https://api.github.com/users/matthewadams/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":16,"created_at":"2015-12-14T21:41:38Z","updated_at":"2015-12-18T15:54:02Z","closed_at":null,"body":"I've authored my app so that the default configuration values in `config/default.json` make the app runnable (on a dev's machine, for instance).  However, in other environments (unit-test, qa, staging, production), I want to override config values, but not have to copy my environment-specific config file into my app's config dir but still use the defaults found in my app's `config/default.json`.\r\n\r\nAccording to the docs, setting `NODE_CONFIG_DIR` changes the config directory that's searched for config files -- I'm assuming *all* config files.  I want to specify an extra directory, *in addition* to `config` so that I don't have to copy, say, `production.json` into `config`.  I want to\r\n  1. leave `production.json` in its well-known place on the production server, say, `/foo/bar/production.json`,\r\n  2. have all defaults in my regular config directory, say `/sna/fu/app/config/default.json`,\r\n  3. set `NODE_ENV` to `production`,\r\n  4. set `NODE_CONFIG_DIRS` to `/foo/bar`,\r\n  5. fire up my app and have it pick up `/foo/bar/production.json` *and then* `/sna/fu/app/default.json`.\r\n \r\nBy using `NODE_CONFIG_DIRS` (with an `S`), `config`\r\n  1. leaves legacy behavior of `NODE_CONFIG_DIR` but allows additional directories to be searched *before* `$DEFAULT_NODE_CONFIG` is searched, and\r\n  2. allows me to copy my application into a directory and just run, no additional copying required (if `NODE_CONFIG_DIRS` is already set).  Yay, one less production deployment step!\r\n\r\nMy requirement is only for one additional directory, but I don't see why multiple additional directories couldn't be supported using either JavaScript array notation (`like ['/foo/bar','/goo/far']`) or a single string with platform-specific path separators (like `/foo/bar:/goo/far`on *n*x or `\\foo\\bar;\\goo\\far` on Win) where first config file found wins."},"comment":{"url":"https://api.github.com/repos/lorenwest/node-config/issues/comments/165813253","html_url":"https://github.com/lorenwest/node-config/issues/276#issuecomment-165813253","issue_url":"https://api.github.com/repos/lorenwest/node-config/issues/276","id":165813253,"user":{"login":"matthewadams","id":449952,"avatar_url":"https://avatars.githubusercontent.com/u/449952?v=3","gravatar_id":"","url":"https://api.github.com/users/matthewadams","html_url":"https://github.com/matthewadams","followers_url":"https://api.github.com/users/matthewadams/followers","following_url":"https://api.github.com/users/matthewadams/following{/other_user}","gists_url":"https://api.github.com/users/matthewadams/gists{/gist_id}","starred_url":"https://api.github.com/users/matthewadams/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matthewadams/subscriptions","organizations_url":"https://api.github.com/users/matthewadams/orgs","repos_url":"https://api.github.com/users/matthewadams/repos","events_url":"https://api.github.com/users/matthewadams/events{/privacy}","received_events_url":"https://api.github.com/users/matthewadams/received_events","type":"User","site_admin":false},"created_at":"2015-12-18T15:54:02Z","updated_at":"2015-12-18T15:54:02Z","body":"Dude.  Sweet.  :)"}}