You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The name of CLI prameter and environment variables are same.
121
122
123
+
122
124
Conf key in `reload(conf)` is named with "LOWER CAMEL", CLI or ENV parameter is named with "SNAKE" with adding "ILA_" (come from Ip-Location-Api).
123
125
124
126
|`reload(conf)`| CLI or ENV | default | description |
@@ -132,28 +134,40 @@ Conf key in `reload(conf)` is named with "LOWER CAMEL", CLI or ENV parameter is
132
134
| licenseKey | ILA_LICENSE_KEY | redist | By setting [MaxMind](https://www.maxmind.com/) License key, you can download latest version of database from [MaxMind](https://www.maxmind.com/) server. By setting to "redist", you can download the database from [node-geolite2-redist](https://github.com/sapics/node-geolite2-redist) repository which re-distribute the GeoLite2 database. |
133
135
| ipLocationDb | ILA_IP_LOCATION_DB || When you need only "country" field, you can use [ip-location-db](https://github.com/sapics/ip-location-db) data |
134
136
| downloadType | ILA_DOWNLOAD_TYPE | reuse | By setting to "false", "tmpDataDir" directory is deleted every update. "reuse" dose not delete "tmpDataDir" and re-use "tmpDataDir"'s database if the database file dose not update. |
137
+
| autoUpdate | ILA_AUTO_UPDATE | default | By setting to "false", it dose not update automatically. "default" updates twice weekly. You can set CRON PATTERN FORMAT which is provided by [cron](https://github.com/kelektiv/node-cron) with UTC timezone (For example, ILA_AUTO_UPDATE="0 1 * * *" for daily update). |
135
138
| multiDbDir | ILA_MULTI_DB_DIR | false | If you use multiple "dataDir", please make this value to "true" |
136
139
| series | ILA_SERIES | GeoLite2 | By setting to "GeoIP2", you can use premium database "GeoIP2" |
137
140
| language | ILA_LANGUAGE | en | You can choose "de", "en", "es", "fr", "ja", "pt-BR", "ru", "zh-CN". By changing, the language of "region1_name", "region2_name", "city" fields are changed |
138
141
139
142
140
143
### Update database
141
144
142
-
You can update the database by two way.
143
-
First is `await updateDb()` which is the recommended one, because api's in-memory database is auto reloaded after database update.
144
-
Second is `watchDb()` and CLI command `npm run updatedb`.
145
-
The CLI command update the database and `watchDb` reload api's in-memory database by watching the database directory's change ("dataDir").
145
+
```javascript
146
+
import { updateDb } from'ip-location-api'
147
+
awaitupdateDb(setting)
148
+
```
149
+
150
+
or
151
+
152
+
```bash
153
+
npm run updatedb
154
+
```
146
155
147
156
There are three database update way, "ILA_LICENSE_KEY=redist" or "ILA_LICENSE_KEY=YOUR_GEOLITE2_LICENSE_KEY" or "ILA_IP_LOCATION_DB=YOUR_CHOOSEN_DATABSE".
148
157
149
-
When you set "ILA_LICENSE_KEY=redist", you can download GeoLite2 database from redistribution repository [node-geolite2-redist](https://github.com/sapics/node-geolite2-redist).
158
+
When you set "ILA_LICENSE_KEY=redist", it downloads GeoLite2 database from the redistribution repository [node-geolite2-redist](https://github.com/sapics/node-geolite2-redist).
150
159
151
-
YOUR_GEOLITE2_LICENSE_KEY should be replaced by a valid GeoLite2 license key. Please [follow instructions](https://dev.maxmind.com/geoip/geoip2/geolite2/) provided by MaxMind to obtain a license key.
160
+
When you set "ILA_LICENSE_KEY=YOUR_GEOLITE2_LICENSE_KEY", it downloads GeoLite2 dastabase from the MaxMind provided server.
161
+
`YOUR_GEOLITE2_LICENSE_KEY` should be replaced by a valid GeoLite2 license key. Please [follow instructions](https://dev.maxmind.com/geoip/geoip2/geolite2/) provided by MaxMind to obtain a license key.
152
162
163
+
When you set "ILA_IP_LOCATION_DB=YOUR_CHOOSEN_DATABSE", it downloads from the [ip-location-db](https://github.com/sapics/ip-location-db) (country type only).
153
164
You can "YOUR_CHOOSEN_DATABSE" from [ip-location-db](https://github.com/sapics/ip-location-db) with country type. For example, "geolite2-geo-whois-asn" is wider IP range country database which is equivalent to GeoLite2 database result for GeoLite2 country covered IP range and geo-whois-asn-country for the other IP range.
154
165
The other example, "geo-whois-asn" is [CC0 licensed database](https://github.com/sapics/ip-location-db/tree/main/geo-asn-country), if you are unable to apply the GeoLite2 License.
155
166
156
167
168
+
After v2.0, the database is created automatically at initial startup, and updated automatically by setting `ILA_AUTO_UPDATE` which updates twice weekly with default setting.
169
+
170
+
157
171
## How to use with an example
158
172
159
173
When you need only geographic coordinates, please set "ILA_FIELDS=latitude,longitude".
@@ -219,6 +233,7 @@ This library supports Node.js >= 14 for ESM and CJS.
219
233
There are multiple licenses in this library, one for the software library, and the others for the datadata.
220
234
Please read the LICENSE and EULA files for details.
221
235
236
+
222
237
The license for the software itself is published under MIT License by [sapics](https://github.com/sapics).
223
238
224
239
@@ -229,8 +244,7 @@ The GeoLite2 database comes with certain restrictions and obligations, most nota
229
244
- to identify specific households or individuals.
230
245
231
246
You can read [the latest version of GeoLite2 EULA](https://www.maxmind.com/en/geolite2/eula).
232
-
GeoLite2 database is provided under [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/) by [MaxMind](https://www.maxmind.com/), so, you must create attribusion to [MaxMind](https://www.maxmind.com/) for using GeoLite2 database.
247
+
GeoLite2 database is provided under [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/) by [MaxMind](https://www.maxmind.com/), so, you need to create attribusion to [MaxMind](https://www.maxmind.com/) for using GeoLite2 database.
233
248
234
249
235
250
The database of [Countries](https://github.com/annexare/Countries) is published under MIT license by [Annexare Studio](https://annexare.com/).
0 commit comments