Skip to content

Commit

Permalink
Merge branch 'master' of github.com:mrspartak/js-internet-status-api
Browse files Browse the repository at this point in the history
  • Loading branch information
mrspartak committed Feb 12, 2020
2 parents bf0af5a + 2496569 commit dfd6342
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,42 @@ Return JSON with current status and disconnects history

[![Latest Github tag](https://img.shields.io/github/v/tag/mrspartak/js-internet-status-api?sort=date&style=for-the-badge "Latest Github tag")](https://github.com/mrspartak/js-internet-status-api/releases "Latest Github tag")

## Docker run
Run with defaults
```
docker run -p 3010:3010 --name internet-check \
-v internet-check:/home/node/app/data \
assorium/js-internet-status-api:latest
```
Or use environment variables
```
docker run -p 3010:3010 --name internet-check \
-v internet-check:/home/node/app/data \
-e CHECK_WEBSITE=https://example.com -e RELEVANCE_TIMEOUT=1 \
assorium/js-internet-status-api:latest
```

## Environment variables

#port app will be launched at
const PORT = process.env.PORT || 3010

#interval to check connection in seconds
const INTERVAL = +process.env.INTERVAL * 1000 || 10000;

#website to check connection
const CHECK_WEBSITE = process.env.CHECK_WEBSITE || 'https://google.com';
#timeout in seconds
const CHECK_TIMEOUT = +process.env.CHECK_TIMEOUT * 1000 || 5000;
#retries
const CHECK_RETRIES = +process.env.CHECK_RETRIES || 2;

#this time in hours data will be stored
const RELEVANCE_TIMEOUT = +process.env.RELEVANCE_TIMEOUT * 60 * 60 || 24 * 60 * 60;

## API

#just GET / request

#sample response
JSON API | GET /
```
{
success: true,
Expand All @@ -42,4 +57,7 @@ Return JSON with current status and disconnects history
}
]
}
```
```

Graphs | GET /graph.html
![image](https://user-images.githubusercontent.com/993910/74189670-e6722380-4c61-11ea-9b8e-c8860138f95c.png)

0 comments on commit dfd6342

Please sign in to comment.