diff --git a/convict/convict-tests.ts b/convict/convict-tests.ts index a36b23480..6cde3b38c 100644 --- a/convict/convict-tests.ts +++ b/convict/convict-tests.ts @@ -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']); diff --git a/convict/convict.d.ts b/convict/convict.d.ts index dc2b8e82b..74ed10038 100644 --- a/convict/convict.d.ts +++ b/convict/convict.d.ts @@ -8,7 +8,7 @@ declare module "convict" { module convict { interface Schema { - [name: string]: { + [name: string]: convict.Schema | { default: any; doc?: string; format?: any;