How to use the defaults function from nconf

Find comprehensive JavaScript nconf.defaults code examples handpicked from public code repositorys.

39
40
41
42
43
44
45
46
47
48
    file = name;
  }
  return module.exports.use(name, { type: 'file', file });
},
defaults: d => {
  nconf.defaults(encrypt(d));
  return module.exports;
},
overrides: d => {
  nconf.overrides(encrypt(d));
fork icon0
star icon3
watch icon2

46
47
48
49
50
51
52
53
54
55
56
function loadConfig(configFile) {
    nconf.file({
        file: configFile,
    });


    nconf.defaults({
        base_dir: paths.baseDir,
        themes_path: paths.themes,
        upload_path: 'public/uploads',
        views_dir: path.join(paths.baseDir, 'build/public/templates'),
fork icon0
star icon2
watch icon5

+ 2 other calls in file

52
53
54
55
56
57
58
59
60
61
nconf.env({
  logicalSeparator: '.', 
  whitelist: this.whitelist,
})

nconf.defaults(this.defaults)

nconf.load()
logger(`config ready: ${this.basePath}/${file_name}`)
this.started = true
fork icon0
star icon0
watch icon2

+ 3 other calls in file

21
22
23
24
25
26
27
28
29
30
nconf.file('base.yaml', { file: 'config/base.yaml', format: yaml });

//
// 5. Any default values
//
// nconf.defaults({
//      'if nothing else': 'use this value'
// });

// Validate that there aren't missing values
fork icon0
star icon0
watch icon2