Skip to content

Instantly share code, notes, and snippets.

@morph027
Last active August 24, 2020 16:05
Show Gist options
  • Save morph027/e7aa27a1d3feae49bcf9c8a4582bb9a9 to your computer and use it in GitHub Desktop.
Save morph027/e7aa27a1d3feae49bcf9c8a4582bb9a9 to your computer and use it in GitHub Desktop.
#!/bin/bash
nc_secret="$(openssl rand -hex 16)"
janus_api_key="$(openssl rand -base64 16)"
cat > /tmp/script.conf << EOF
[http]
listen = 127.0.0.1:8081
[app]
debug = false
[sessions]
hashkey = $(openssl rand -hex 16)
blockkey = $(openssl rand -hex 16)
[clients]
internalsecret = $(openssl rand -hex 16)
[backend]
allowed = ${NC_DOMAIN}
allowall = false
secret = ${nc_secret}
timeout = 10
connectionsperhost = 8
[nats]
url = nats://localhost:4222
[mcu]
type = janus
url = ws://127.0.0.1:8188
[turn]
apikey = ${janus_api_key}
# probably we can get the settings from ourselves as we are installing coturn.
# do we know about the secret in some variable?
secret = ${turn_secret}
# do we know about the domain and the endpoint in some variable?
# looks like: turn:example.com:3478?transport=tcp
servers = ${turn_server}
EOF
sed -i 's,#turn_rest_api_key\s*=.*,turn_rest_api_key = "'"${janus_api_key}"'",' /etc/janus/janus.jcfg.dpkg-dist
systemctl restart janus
echo "enter nc secret into your talk settings: ${nc_secret}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment