indexzero / nconf

Hierarchical node.js configuration with files, environment variables, command-line arguments, and atomic object merging.
https://github.com/indexzero/nconf
MIT License
3.87k stars 255 forks source link

Incorrect nesting of Object when value is Object and Object properties contain a colon #393

Open dbrixey opened 3 years ago

dbrixey commented 3 years ago

Hi,

This looks similar to issue https://github.com/indexzero/nconf/issues/301, but is still present.

nconf version - ^0.11.3 node version - v14.18.1

Example code:

  nconf.add('env', {type: 'file', file: configFilePath, accessSeparator: '.', logicalSeparator: '.'})
  const metaData = {
    'https://some.site.com##metadata' : {
      siteKey: 'siteValue'
    }
  };
  nconf.set('metaData', metaData)
  console.log(nconf.get('metaData'));
  // Output (internal object split by default separator)
  // { https: { '//some.site.com##metadata': { siteKey: 'siteValue' } } }

I expect the object structure of 'metaData' to be preserved.

output of default.json:

{
  "isTest": true
}

FWIW I tried the beta version and still experienced the issue.