eyra / mono

Next platform repo
https://eyra.co
GNU Affero General Public License v3.0
7 stars 4 forks source link

Runtime rate quotas #899

Closed mellelieuwes closed 2 months ago

mellelieuwes commented 2 months ago

quotas: [ [service: :storage_export, limit: 10, unit: :call, window: :minute, scope: :local], [service: :azure_blob, limit: 1, unit: :call, window: :second, scope: :local], [service: :azure_blob, limit: 100, unit: :byte, window: :second, scope: :local] ]

mellelieuwes commented 2 months ago

A new runtime env variable is introduced: RATE_QUOTAS

The value is a string with a json list with objects that have the following properties:

  1. service: one of {storage_export, azure_blob}
  2. limit: integer
  3. unit: one of {byte, call}
  4. window: one of {day, hour, minute, second}
  5. scope: one of {local, global}

Scope local means one ip adres, global means all users.

Example:

[ {\"service\": \"storage_export\", \"limit\": 10, \"unit\": \"call\", \"window\": \"minute\", \"scope\": \"local\"}, {\"service\": \"storage_export\", \"limit\": 1000000, \"unit\": \"byte\", \"window\": \"day\", \"scope\": \"local\"}, {\"service\": \"storage_export\", \"limit\": 100000000, \"unit\": \"byte\", \"window\": \"day\", \"scope\": \"global\"} ]

TjerkNan commented 2 months ago

werkt goed