-
-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathindex.js
35 lines (29 loc) · 882 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
'use strict';
const peliasConfig = require('pelias-config').generate(require('./schema'));
const through = require('through2');
const _ = require('lodash');
const os = require('os');
function create(layers) {
if (peliasConfig.imports.adminLookup.enabled) {
return require('./src/lookupStream')(resolver(layers),
peliasConfig.imports.adminLookup);
} else {
return through.obj();
}
}
function resolver(layers) {
if (_.has(peliasConfig, 'imports.services.pip')) {
return require('./src/remotePipResolver')(peliasConfig.imports.services.pip, layers);
} else {
return localResolver(layers);
}
}
function localResolver(layers) {
const datapath = peliasConfig.imports.whosonfirst.datapath;
return require('./src/localPipResolver')(datapath, layers);
}
module.exports = {
create: create,
resolver: resolver,
localResolver: localResolver
};