Merge pull request #3480 from optical/convict-schema-improvements

Use union type to represent convict schema.
This commit is contained in:
John Reilly
2015-01-18 20:37:58 +00:00
2 changed files with 18 additions and 1 deletions
+17
View File
@@ -32,12 +32,29 @@ var conf = convict({
format: (val: string) => validator.isUUID(val),
default: '01527E56-8431-11E4-AF91-47B661C210CA'
},
db: {
ip: {
doc: 'The IP address to bind.',
format: 'ipaddress',
default: '127.0.0.1',
env: 'IP_ADDRESS',
},
port: {
doc: 'The port to bind.',
format: 'port',
default: 0,
env: 'PORT',
arg: 'port',
}
}
});
// load environment dependent configuration
var env = conf.get('env');
var dbip = conf.get('db.ip');
conf.loadFile('./config/' + env + '.json');
conf.loadFile(['./configs/always.json', './configs/sometimes.json']);
+1 -1
View File
@@ -8,7 +8,7 @@ declare module "convict" {
module convict {
interface Schema {
[name: string]: {
[name: string]: convict.Schema | {
default: any;
doc?: string;
format?: any;