Skip to content

Instantly share code, notes, and snippets.

@morph027

morph027/talk-bootstrap.sh

Last active Aug 24, 2020
Embed
What would you like to do?
#!/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