forked from runk/node-geolite2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
26 lines (22 loc) · 638 Bytes
/
Copy pathindex.js
File metadata and controls
26 lines (22 loc) · 638 Bytes
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
const path = require('path');
const { getSelectedDbs } = require('./utils');
const selected = getSelectedDbs();
const makePath = (edition) => path.resolve(__dirname, `dbs/${edition}.mmdb`);
const paths = selected.reduce((a, c) => {
const aliases = {
'GeoLite2-ASN': 'asn',
'GeoLite2-City': 'city',
'GeoLite2-Country': 'country',
};
// The keys are the database names.
a[c] = makePath(c);
// For backward compatibility, we also populate the 'city', 'asn', and
// 'country' keys for GeoLite databases.
if (c in aliases) {
a[aliases[c]] = makePath(c);
}
return a;
}, {});
module.exports = {
paths,
};