File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ function getConfig(deep) {
41
41
// load config from ENV
42
42
let custom_config ;
43
43
if ( process . env . hasOwnProperty ( 'PELIAS_CONFIG' ) ) {
44
- custom_config = require ( process . env . PELIAS_CONFIG ) ;
44
+ custom_config = require ( path . resolve ( process . env . PELIAS_CONFIG ) ) ;
45
45
} else if ( fs . existsSync ( localpath ) ) {
46
46
custom_config = require ( localpath ) ;
47
47
}
Original file line number Diff line number Diff line change @@ -185,6 +185,19 @@ module.exports.generate.paths = function(test) {
185
185
delete process . env . PELIAS_CONFIG ;
186
186
} ) ;
187
187
188
+ test ( 'relative paths supported from any location' , function ( t ) {
189
+ process . chdir ( './config' ) ;
190
+ // set the relative PELIAS_CONFIG env var
191
+ process . env . PELIAS_CONFIG = './env.json' ;
192
+
193
+ var c = config . generate ( ) ;
194
+ t . deepEqual ( c , expected , 'loaded relative file path' ) ;
195
+ t . end ( ) ;
196
+
197
+ // unset the PELIAS_CONFIG env var
198
+ delete process . env . PELIAS_CONFIG ;
199
+ } ) ;
200
+
188
201
test ( 'invalid paths in ENV var throws exception' , function ( t ) {
189
202
190
203
// set the relative PELIAS_CONFIG env var
You can’t perform that action at this time.
0 commit comments