Skip to content
This repository has been archived by the owner on Oct 1, 2020. It is now read-only.

support listeners in --env #70

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions kafka/scripts/start-kafka.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Optional ENV variables:
# * ADVERTISED_HOST: the external ip for the container, e.g. `docker-machine ip \`docker-machine active\``
# * ADVERTISED_PORT: the external port for Kafka, e.g. 9092
# * LISTENERS: configure the listener list e.g. "PLAINTEXT://:9092"
# * ZK_CHROOT: the zookeeper chroot that's used by Kafka (without / prefix), e.g. "kafka"
# * LOG_RETENTION_HOURS: the minimum age of a log file in hours to be eligible for deletion (default is 168, for 1 week)
# * LOG_RETENTION_BYTES: configure the size at which segments are pruned from the log, (default is 1073741824, for 1GB)
Expand Down Expand Up @@ -32,6 +33,16 @@ if [ ! -z "$ADVERTISED_PORT" ]; then
fi
fi

# Set the listener list
if [ ! -z "$LISTENERS" ]; then
echo "listeners : $LISTENERS"
if grep -q "^listeners" $KAFKA_HOME/config/server.properties; then
sed -r -i "s/#(listeners)=(.*)/\1=$(echo $LISTENERS | sed -e 's/[\/&]/\\&/g')/g" $KAFKA_HOME/config/server.properties
else
echo "listeners=$LISTENERS" >> $KAFKA_HOME/config/server.properties
fi
fi

# Set the zookeeper chroot
if [ ! -z "$ZK_CHROOT" ]; then
# wait for zookeeper to start up
Expand Down