From c9701494f154935bba9b1c531787ddb49bdf50e3 Mon Sep 17 00:00:00 2001 From: Felix Bartels <1257835+fbartels@users.noreply.github.com> Date: Mon, 23 Mar 2020 16:42:11 +0100 Subject: [PATCH] Make registration_conf configurable through an env (#369) * Make registration_conf configurable through an env Fixes https://github.com/zokradonh/kopano-docker/issues/368 Signed-off-by: Felix Bartels * add registration_conf to meet example Signed-off-by: Felix Bartels --- docker-compose.yml | 1 + examples/meet/docker-compose.yml | 1 + kwmserver/wrapper.sh | 36 +++++++++++++------------------- 3 files changed, 16 insertions(+), 22 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 73261a3..460fe18 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -414,6 +414,7 @@ services: - INSECURE=${INSECURE} - oidc_issuer_identifier=https://${FQDN} - public_guest_access_regexp=^group/public/.* + - registration_conf=/kopano/ssl/konnectd-identifier-registration.yaml env_file: - kopano_kwmserver.env volumes: diff --git a/examples/meet/docker-compose.yml b/examples/meet/docker-compose.yml index 5c22eb3..e238cf8 100644 --- a/examples/meet/docker-compose.yml +++ b/examples/meet/docker-compose.yml @@ -156,6 +156,7 @@ services: - INSECURE=${INSECURE} - oidc_issuer_identifier=https://${FQDN} - public_guest_access_regexp=^group/public/.* + - registration_conf=/kopano/ssl/konnectd-identifier-registration.yaml - turn_service_credentials_password=${TURN_PASSWORD} - turn_service_credentials_user=${TURN_USER} volumes: diff --git a/kwmserver/wrapper.sh b/kwmserver/wrapper.sh index 27da12e..20e58f3 100755 --- a/kwmserver/wrapper.sh +++ b/kwmserver/wrapper.sh @@ -2,18 +2,16 @@ set -e -# shellcheck disable=SC2154 -if [ -n "$log_level" ]; then +if [ -n "${log_level:-}" ]; then set -- "$@" --log-level="$log_level" fi # shellcheck disable=SC2154 -if [ -n "$oidc_issuer_identifier" ]; then +if [ -n "${oidc_issuer_identifier:-}" ]; then set -- "$@" --iss="$oidc_issuer_identifier" fi -# shellcheck disable=SC2154 -if [ "$enable_guest_api" = "yes" ]; then +if [ "${enable_guest_api:-}" = "yes" ]; then set -- "$@" --enable-guest-api fi @@ -22,46 +20,38 @@ if [ "$INSECURE" = "yes" ]; then fi # kwmserver turn -# shellcheck disable=SC2154 -if [ -z "$turn_service_url" ]; then - turn_service_url=https://turnauth.kopano.com/turnserverauth/ -fi +# default to Kopano turn service +turn_service_url=${turn_service_url:-https://turnauth.kopano.com/turnserverauth/} if [ -n "$turn_service_url" ]; then set -- "$@" --turn-service-url="$turn_service_url" fi -# shellcheck disable=SC2154 -if [ -n "$turn_service_credentials_user" ] && [ -n "$turn_service_credentials_password" ]; then +if [ -n "${turn_service_credentials_user:-}" ] && [ -n "${turn_service_credentials_password:-}" ]; then turn_service_credentials=/tmp/turn_service_credentials echo "$turn_service_credentials_user":"$turn_service_credentials_password" > "$turn_service_credentials" fi -# shellcheck disable=SC2154 -if [ -n "$turn_service_credentials" ]; then +if [ -n "${turn_service_credentials:-}" ]; then set -- "$@" --turn-service-credentials="$turn_service_credentials" fi -# shellcheck disable=SC2154 -if [ -n "$turn_server_shared_secret" ]; then +if [ -n "${turn_server_shared_secret:-}" ]; then set -- "$@" --turn-server-shared-secret="$turn_server_shared_secret" fi -# shellcheck disable=SC2154 -if [ -n "$turn_uris" ]; then +if [ -n "${turn_uris:-}" ]; then for uri in $turn_uris; do set -- "$@" --turn-uri="$uri" done fi # kwmserver guest -# shellcheck disable=SC2154 -if [ "$allow_guest_only_channels" = "yes" ]; then +if [ "${allow_guest_only_channels:-}" = "yes" ]; then set -- "$@" --allow-guest-only-channels fi -# shellcheck disable=SC2154 -if [ -n "$public_guest_access_regexp" ]; then +if [ -n "${public_guest_access_regexp:-}" ]; then set -- "$@" --public-guest-access-regexp="$public_guest_access_regexp" fi @@ -81,6 +71,8 @@ dockerize \ -wait file:///etc/machine-id \ -wait file:///var/lib/dbus/machine-id +registration_conf=${registration_conf:-/etc/kopano/kwmserverd-registration.yaml} + exec /usr/local/bin/docker-entrypoint.sh serve \ - --registration-conf /kopano/ssl/konnectd-identifier-registration.yaml \ + --registration-conf "$registration_conf" \ "$@"