[Feature Request] check method to check if key exist or not
Rstar1998 opened this issue · 0 comments
Rstar1998 commented
Is it possible to provide a method which checks if a key or keypath exists or not , like in the example shown below ?
var convict = require("convict");
var config = convict({
env: {
doc: 'The application environment.',
format: String,
default: 'development',
env: 'NODE_ENV'
},
ip: {
doc: 'The IP address to bind.',
format: String,
default: '127.0.0.1',
env: 'IP_ADDRESS',
},
port: {
doc: 'The port to bind.',
format: 'int',
default: 8080,
env: 'PORT',
arg: 'port'
}
});
config.get('ports'); // gives me error since its not in schema
/*
can we have something like this ?
if (config.checkpath('ports')){
}
else
{
}
*/