cdist/cdist/conf/type/__coturn/manifest

53 lines
1.5 KiB
Bash
Executable File

#!/bin/sh -e
#
# 2020 Timothée Floure (timothee.floure@ungleich.ch)
#
# This file is part of cdist.
#
# cdist is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# cdist is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
#
__package coturn
# Optional parameters.
if [ -f "$__object/parameter/use_auth_secret" ]; then
export USE_AUTH_SECRET=1
fi
if [ -f "$__object/parameter/static_auth_secret" ]; then
export STATIC_AUTH_SECRET=$(cat "$__object/parameter/static_auth_secret")
fi
if [ -f "$__object/parameter/realm" ]; then
export REALM=$(cat "$__object/parameter/realm")
fi
if [ -f "$__object/parameter/no_tcp_relay" ]; then
export NO_TCP_RELAY=$(cat "$__object/parameter/no_tcp_relay")
fi
# Hardcoded.
coturn_config='/etc/turnserver.conf'
# Generate and deploy configuration file.
mkdir -p "$__object/files"
"$__type/files/turnserver.conf.sh" > "$__object/files/turnserver.conf"
__file $coturn_config \
--source "$__object/files/turnserver.conf" \
--state present
# Restart coturn server.
require="__file/$coturn_config" __service coturn --action restart