Skip to content

Commit e4e66a7

Browse files
committed
allow our generated attributes to be overridden by external environment variables
1 parent f29c6e5 commit e4e66a7

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

start-kafka.sh

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
#!/bin/bash
22

3-
export KAFKA_ADVERTISED_PORT=$(docker port `hostname` 9092 | sed -r "s/.*:(.*)/\1/g")
4-
export KAFKA_BROKER_ID=$KAFKA_ADVERTISED_PORT
5-
export KAFKA_LOG_DIRS="\/kafka\/kafka-logs-$KAFKA_BROKER_ID"
6-
3+
if [[ -z "$KAFKA_ADVERTISED_PORT" ]]; then
4+
export KAFKA_ADVERTISED_PORT=$(docker port `hostname` 9092 | sed -r "s/.*:(.*)/\1/g")
5+
fi
6+
if [[ -z "$KAFKA_BROKER_ID" ]]; then
7+
export KAFKA_BROKER_ID=$KAFKA_ADVERTISED_PORT
8+
fi
9+
if [[ -z "$KAFKA_LOG_DIRS" ]]; then
10+
export KAFKA_LOG_DIRS="\/kafka\/kafka-logs-$KAFKA_BROKER_ID"
11+
fi
712
if [[ -z "$KAFKA_ZOOKEEPER_CONNECT" ]]; then
813
export KAFKA_ZOOKEEPER_CONNECT=$(env | grep ZK.*PORT_2181_TCP= | sed -e 's|.*tcp://||' | paste -sd ,)
914
fi

0 commit comments

Comments
 (0)