#!/bin/bash
# (Copyright) [2017 - 2017] Confluent, Inc.

#
# Use shellcheck to lint this file
#
set -ue

base_dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )
if [ "$base_dir" = "/" ]; then
    base_dir=""
fi
: "${KSQL_CONFIG_DIR:="$base_dir/config"}"

: "${KSQL_LOG4J_OPTS:=""}"
if [ -z "$KSQL_LOG4J_OPTS" ] && [ -e "$KSQL_CONFIG_DIR/log4j2-silent.yaml" ]; then
  export KSQL_LOG4J_OPTS="-Dlog4j2.configurationFile=file:$KSQL_CONFIG_DIR/log4j2-silent.yaml"
fi

exec "$base_dir"/bin/ksql-run-class io.confluent.ksql.datagen.DataGen "$@"
