Skip to content
This repository was archived by the owner on Apr 6, 2020. It is now read-only.

Commit ff3f89d

Browse files
committed
Allow config files with digits only
Resolves #61
1 parent 80ea16c commit ff3f89d

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lib/config.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ var config = convict({
77
application: {
88
config: {
99
doc: 'name of the config to load',
10-
format: String,
10+
format: function check(val) {
11+
if (!/^.+$/.test(val)) {
12+
throw new Error('must be a string or number');
13+
}
14+
},
1115
default: 'default',
1216
env: 'CONFIG',
1317
arg: 'config',
@@ -278,10 +282,9 @@ var config = convict({
278282
},
279283
});
280284

281-
282285
var configFilename = __dirname + '/../config/' + config.get('application.config') + '.yml';
283286
if (fs.existsSync(configFilename)) {
284-
console.log('Using custom config', configFilename);
287+
console.log('Using custom config', path.resolve(configFilename));
285288
try {
286289
var doc = yaml.safeLoad(fs.readFileSync(configFilename, 'utf8'));
287290
config.load(doc);

0 commit comments

Comments
 (0)