Skip to content

Commit 3ba77e1

Browse files
lalayuehlala
andauthored
feat(prosody) - Added TURN_USERNAME and TURN_PASSWORD (#1989)
Co-authored-by: lala <lala@mediot.com.tw>
1 parent 82e98d2 commit 3ba77e1

File tree

2 files changed

+43
-3
lines changed

2 files changed

+43
-3
lines changed

docker-compose.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,8 @@ services:
304304
- STUN_HOST
305305
- STUN_PORT
306306
- TURN_CREDENTIALS
307+
- TURN_USERNAME
308+
- TURN_PASSWORD
307309
- TURN_HOST
308310
- TURNS_HOST
309311
- TURN_PORT

prosody/rootfs/defaults/prosody.cfg.lua

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ log = {
331331
{{ end }}
332332
}
333333

334-
{{ if $PROSODY_ENABLE_METRICS }}
334+
{{ if $PROSODY_ENABLE_METRICS }}
335335
-- Statistics Provider configuration
336336
statistics = "internal"
337337
statistics_interval = "manual"
@@ -351,15 +351,53 @@ external_services = {
351351
{{- range $idx1, $host := $TURN_HOSTS -}}
352352
{{- range $idx2, $transport := $TURN_TRANSPORTS -}}
353353
{{- if or $STUN_HOST $idx1 $idx2 -}},{{- end }}
354-
{ type = "turn", host = "{{ $host }}", port = {{ $TURN_PORT }}, transport = "{{ $transport }}", secret = true, ttl = {{ $TURN_TTL }}, algorithm = "turn" }
354+
{
355+
type = "turn",
356+
host = "{{ $host }}",
357+
port = {{ $TURN_PORT }},
358+
transport = "{{ $transport }}",
359+
ttl = {{ $TURN_TTL }},
360+
361+
{{ if $.Env.TURN_CREDENTIALS -}}
362+
secret = true,
363+
algorithm = "turn",
364+
{{- end }}
365+
366+
{{ if $.Env.TURN_USERNAME -}}
367+
username = "{{$.Env.TURN_USERNAME}}",
368+
{{- end }}
369+
370+
{{ if $.Env.TURN_PASSWORD -}}
371+
password = "{{$.Env.TURN_PASSWORD}}",
372+
{{- end }}
373+
}
355374
{{- end -}}
356375
{{- end -}}
357376
{{- end -}}
358377

359378
{{- if $TURNS_HOST -}}
360379
{{- range $idx, $host := $TURNS_HOSTS -}}
361380
{{- if or $STUN_HOST $TURN_HOST $idx -}},{{- end }}
362-
{ type = "turns", host = "{{ $host }}", port = {{ $TURNS_PORT }}, transport = "tcp", secret = true, ttl = {{ $TURN_TTL }}, algorithm = "turn" }
381+
{
382+
type = "turns",
383+
host = "{{ $host }}",
384+
port = {{ $TURNS_PORT }},
385+
transport = "tcp",
386+
ttl = {{ $TURN_TTL }},
387+
388+
{{ if $.Env.TURN_CREDENTIALS -}}
389+
secret = true,
390+
algorithm = "turn",
391+
{{- end }}
392+
393+
{{ if $.Env.TURN_USERNAME -}}
394+
username = "{{$.Env.TURN_USERNAME}}",
395+
{{- end }}
396+
397+
{{ if $.Env.TURN_PASSWORD -}}
398+
password = "{{$.Env.TURN_PASSWORD}}",
399+
{{- end }}
400+
}
363401
{{- end }}
364402
{{- end }}
365403
};

0 commit comments

Comments
 (0)