Skip to content

Commit

Permalink
fix: add GEOTMPDIR env (#258)
Browse files Browse the repository at this point in the history
* fix: support tmp dir overwrite with env var
* docs: env vars chapter
  • Loading branch information
busla authored Sep 20, 2023
1 parent 41d752c commit f273b48
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,18 @@ geoip.startWatchingDataUpdate();

This tool can be used with `npm run-script updatedb` to periodically update geo data on a running server.

#### Environment variables

The following environment variables can be set.

```bash
# Override the default node_modules/geoip-lite/data dir
GEOTMPDIR=/some/path

# Override the default node_modules/geoip-lite/tmp dir
GEODATADIR=/some/path
```

Caveats
-------

Expand Down
2 changes: 1 addition & 1 deletion scripts/updatedb.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ if (typeof geodatadir !== 'undefined') {
process.exit(1);
}
}
var tmpPath = path.resolve(__dirname, '..', 'tmp');
var tmpPath = process.env.GEOTMPDIR ? process.env.GEOTMPDIR : path.resolve(__dirname, '..', 'tmp');
var countryLookup = {};
var cityLookup = {};
var databases = [
Expand Down

0 comments on commit f273b48

Please sign in to comment.