Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gravadigital/ipstack-cache
cache service for https://ipstack.com
https://github.com/gravadigital/ipstack-cache
cache freegeoip info ip node
Last synced: 23 days ago
JSON representation
cache service for https://ipstack.com
- Host: GitHub
- URL: https://github.com/gravadigital/ipstack-cache
- Owner: gravadigital
- Created: 2017-11-24T13:21:49.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2022-12-07T17:35:52.000Z (about 2 years ago)
- Last Synced: 2023-03-03T14:17:42.902Z (almost 2 years ago)
- Topics: cache, freegeoip, info, ip, node
- Language: JavaScript
- Homepage:
- Size: 271 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# IpStack cache
This node proyect cache data from https://ipstack.com (old https://freegeoip.net/)## Run using docker image
Use image from https://hub.docker.com/r/gravadigital/ipstack-cache
```
docker pull gravadigital/ipstack-cache
```
Use `docker-compose.yml` file as reference and configure your ipstack api key in `IPSTACK_TOKEN` environment variable.## Run localy
#### Install dependences
* require node v4 or higher
```
npm install
```#### Configure
Copy .env.template file into .env and set your ipstack api key in `IPSTACK_TOKEN` field.#### Run
```
npm start
```## Usage:
#### Route
```
GET :url/api/ip - return your ip info (not for local ip)
```
```
GET :url/api/ip/xx.xx.xx.xx - return ip info (not for local ip)
```#### Response format
```
{
_id: (String),
ipRange: (String),
countryCode: (String),
countryName: (String),
regionCode: (String),
regionName: (String),
city: (String),
zipCode: (String),
timeZone: (String),
latitude: (Number),
longitude: (Number),
metroCode: (Number)
}
```#### Example
Request:
```
GET /api/ip/181.45.90.105
```
Response:
```
{
"ipRange": "181.45.90",
"countryCode": "AR",
"countryName": "Argentina",
"regionCode": "B",
"regionName": "Buenos Aires",
"city": "Claypole",
"latitude": -34.8,
"longitude": -58.3333
}
```## Generate a new version
First of all, make sure you have incremented the package.json's version.
### Push and tag in Github
Make a commit in master. Then generate a tag pointing to this commit
```
git tag -a 1.1.2
```
where "1.1.2" is the new versionPush the commits and tag
```
git push --tags origin master
```### Publish to DockerHub
#### Login in DockerHub
```
docker login
```
and complete with user and password from https://hub.docker.com#### Build image localy
```
docker build -t gravadigital/ipstack-cache:1.1.2 .
```
where 1.1.2 is the current new versionThen make a "latest" version
```
docker tag gravadigital/ipstack-cache:1.1.2 gravadigital/ipstack-cache:latest
```#### Push to DockerHub
Push both versions: number and latest
```
docker push gravadigital/ipstack-cache:1.1.2
docker push gravadigital/ipstack-cache:latest
```
You must have permissions to edit this project in https://hub.docker.com