瀏覽代碼

Fix validation and prevent empty "external-ip=" lines in Coturn config

We no longer validate that there's an IP address defined.
Seems like Coturn can start without one as well, so there's no need to
require it.

If people populate `matrix_coturn_turn_external_ip_addresses` directly
to specify multiple addresses, they can leave
`matrix_coturn_turn_external_ip_address` empty.

We use the "select not equal to empty string" thing in the for loop
to avoid `matrix_coturn_turn_external_ip_address` leading to
`matrix_coturn_turn_external_ip_addresses: ['']` leading to
`external-ip=` in the Coturn configuration.

Related to https://github.com/spantaleev/matrix-docker-ansible-deploy/pull/1741
pull/1742/head
Slavi Pantaleev 4 年之前
父節點
當前提交
f4ba995d9b
共有 3 個檔案被更改,包括 2 行新增3 行删除
  1. +1
    -1
      roles/matrix-coturn/defaults/main.yml
  2. +0
    -1
      roles/matrix-coturn/tasks/validate_config.yml
  3. +1
    -1
      roles/matrix-coturn/templates/turnserver.conf.j2

+ 1
- 1
roles/matrix-coturn/defaults/main.yml 查看文件

@@ -65,7 +65,7 @@ matrix_coturn_turn_static_auth_secret: ""

# The external IP address of the machine where Coturn is.
matrix_coturn_turn_external_ip_address: ''
matrix_coturn_turn_external_ip_addresses: [ "{{ matrix_coturn_turn_external_ip_address }}" ]
matrix_coturn_turn_external_ip_addresses: ["{{ matrix_coturn_turn_external_ip_address }}"]

matrix_coturn_allowed_peer_ips: []
matrix_coturn_denied_peer_ips: []


+ 0
- 1
roles/matrix-coturn/tasks/validate_config.yml 查看文件

@@ -6,5 +6,4 @@
You need to define a required configuration setting (`{{ item }}`) for using Coturn.
when: "vars[item] == ''"
with_items:
- "matrix_coturn_turn_external_ip_address"
- "matrix_coturn_turn_static_auth_secret"

+ 1
- 1
roles/matrix-coturn/templates/turnserver.conf.j2 查看文件

@@ -5,7 +5,7 @@ realm=turn.{{ matrix_server_fqn_matrix }}

min-port={{ matrix_coturn_turn_udp_min_port }}
max-port={{ matrix_coturn_turn_udp_max_port }}
{% for ip in matrix_coturn_turn_external_ip_addresses %}
{% for ip in matrix_coturn_turn_external_ip_addresses|select('ne', '') %}
external-ip={{ ip }}
{% endfor %}



Loading…
取消
儲存