# delphi-kong
Managed by Terraform.

### Local development
```
make venv
make docker/build
make docker/run
```

request example:
```
curl -v -X GET "http://localhost:8000/v1.1/members/extended?apiKey=key&limit=10" \
--header 'Host: sme.theappreciationengine.com'
```
```
import requests
proxies = {
  'http': 'http://localhost:8000',
}
url = "https://sme.theappreciationengine.com/v1.1/members/extended?apiKey=key&limit=10"
response = requests.get(url, proxies=proxies)
```


# API resources
## Appreciation Engine

Limit per account: 10 000 request per hour


# Generate Kong config using Jinja2 templating
To update config SLZ [gen_config](https://github.com/filtr/delphi-config/tree/master/src/gen_config) tool 
is being used.

If you need to update hour rate limit, change hour_rate_limit value in 
[files/kong/params](./files/kong/params) and run
    
for local development 
   
    make gen/all
   
using docker
   
    make docker/gen/all

Minute rate limits are calculated by formula `max(math.ceil(hour_limit / 60 * 1.1), 85)`.
Minimum minute rate limit SHOULD BE == 85. Unless env will be blocked. Average speed of AE responses 
more than 60 resp per minute.
If you need to set minute limits manually, set `minute_rate_limit` param in [files/kong/params](./files/kong/params)
