瀏覽代碼

Exempt Matrix server from ntfy rate limit

Add the matrix fqdn and localhost to ntfy's exemption list.
Also allow all ntfy rate limits to be configured through Ansible
variables.
pull/2135/head
Karmanyaah Malhotra 3 年之前
父節點
當前提交
b0a6699500
共有 2 個檔案被更改,包括 15 行新增0 行删除
  1. +7
    -0
      roles/custom/matrix-ntfy/defaults/main.yml
  2. +8
    -0
      roles/custom/matrix-ntfy/templates/ntfy/server.yml.j2

+ 7
- 0
roles/custom/matrix-ntfy/defaults/main.yml 查看文件

@@ -14,6 +14,13 @@ matrix_ntfy_docker_image_force_pull: "{{ matrix_ntfy_docker_image.endswith(':lat
# Public facing base URL of the ntfy service
matrix_ntfy_base_url: "https://{{ matrix_server_fqn_ntfy }}"

# Rate limits
matrix_ntfy_limit_burst_rate: 60 # default
matrix_ntfy_limit_replenish_rate: "5s" # default
matrix_ntfy_limit_rate_exempt: "{{matrix_server_fqn_matrix}},localhost" # exempt our matrix server from rate limits, this may not work when the homeserver's outgoing IP is different from the incoming IP, but most small deployments should be fine.
matrix_ntfy_limit_global_topic: 15000 # default
matrix_ntfy_limit_visitor_subscriptions: 30 # default

# Controls whether the container exposes its HTTP port (tcp/80 in the container).
#
# Takes an "<ip>:<port>" or "<port>" value (e.g. "127.0.0.1:2586"), or empty string to not expose.


+ 8
- 0
roles/custom/matrix-ntfy/templates/ntfy/server.yml.j2 查看文件

@@ -2,3 +2,11 @@ base_url: {{ matrix_ntfy_base_url }}
behind_proxy: true
cache_file: /data/cache.db
listen-http: :8080

# Rate Limits
global-topic-limit: {{ matrix_ntfy_limit_global_topic }}
visitor-subscription-limit: {{ matrix_ntfy_limit_visitor_subscriptions }}

visitor-request-limit-burst: {{ matrix_ntfy_limit_burst_rate }}
visitor-request-limit-replenish: "{{ matrix_ntfy_limit_replenish_rate }}"
visitor-request-limit-exempt-hosts: "{{ matrix_ntfy_limit_rate_exempt }}"

Loading…
取消
儲存