diff --git a/README.md b/README.md index 1ad0ffd..54b367d 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Fast offline coarse Geocoder based on GeoNames data. ## Usage ```js -var geocoder = require('geocoder'); +var geocoder = require('geocoder.js'); geocoder('Big Apple', function (location) { /* diff --git a/lib/index.js b/lib/index.js index 0b0bd21..0c5f302 100644 --- a/lib/index.js +++ b/lib/index.js @@ -1,9 +1,16 @@ 'use strict'; var _ = require('lodash'), - db = require('dblite').withSQLite('3.8.6+')(__dirname + '/../data/geonames.db', '-header'), + dblite = require('dblite').withSQLite('3.8.6+'), async = require('async'); +var db; +if (process.env.GEONAMES_SQLITE_DB) { + db = dblite(process.env.GEONAMES_SQLITE_DB, '-header'); +} else { + db = dblite(__dirname + '/../data/geonames.db', '-header'); +} + db.on('close', function (code) { if (code !== 0) { console.error(code); diff --git a/package.json b/package.json index f4f9cc8..d531f26 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "Fast offline coarse Geocoder", "main": "./lib/index.js", "bin": { - "geocoder.js": "build.js" + "geocoder.js": "./data/build.js" }, "scripts": { "test": "echo \"Error: no test specified\" && exit 1"