Skip to content

Commit

Permalink
- Map service was refactored
Browse files Browse the repository at this point in the history
- New map service was added (MapBox)
- Send images as streams to keep key private
- Node docker image updated to lts-alpine3.18
- Config format (.env) was changed (see readme)
- Various small code improvements
  • Loading branch information
AleX83Xpert committed Feb 3, 2024
1 parent 6817359 commit 6c07740
Show file tree
Hide file tree
Showing 11 changed files with 2,088 additions and 65 deletions.
27 changes: 24 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,38 @@ See boot in action: [@EkbTramBot](https://t.me/EkbTramBot)
You must set tokens&keys using `.env` file:
```
BOT_TOKEN="..."
MAPQUEST_KEY="..."
# Use next two values if you use MapQuest service
# MAP_SERVICE="MAPQUEST"
# MAP_SERVICE_CONFIG={"key": "<key>"}
#
# OR
#
# Use next two values if you use MapBox service
# MAP_SERVICE="MAPBOX"
# MAP_SERVICE_CONFIG={"accessToken": "<token>"}
ETTU_API_KEY="111"
```

#### BOT_TOKEN
This is your telegram bot token

#### MAPQUEST_KEY
To show map tiles and markers bot uses `Static Map API`: https://developer.mapquest.com/documentation/static-map-api/v5/
#### MAP_SERVICE
There are two possible values: `MAPQUEST` and `MAPBOX`

##### `MAPQUEST`
To show map tiles and markers bot uses static Map API: https://developer.mapquest.com/documentation/static-map-api/v5/

Please get the key here: https://developer.mapquest.com/user/me/apps

##### `MAPBOX`
Uses the MapBox service: https://docs.maptiler.com/cloud/api/static-maps/

You may gey token here: https://cloud.maptiler.com/account/keys/

#### ETTU_API_KEY
I don't know, just copy this value from http://map.ettu.ru

Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: "3.1"
services:
EkbTramBotApp:
container_name: EkbTramBotApp
image: library/node:14.15.4-alpine
image: library/node:lts-alpine3.18
user: "node"
working_dir: /opt/project
volumes:
Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const logger = require('./logger')
const { EttuService, MapService, TelegramService } = require('./services')

const ettuService = new EttuService(process.env.ETTU_API_KEY)
const mapService = new MapService(process.env.MAPQUEST_KEY)
const mapService = new MapService(JSON.parse(process.env.MAP_SERVICE_CONFIG))

ettuService.init()
.then(() => {
Expand Down
Loading

0 comments on commit 6c07740

Please sign in to comment.