-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathentry.sh
More file actions
executable file
·41 lines (30 loc) · 962 Bytes
/
entry.sh
File metadata and controls
executable file
·41 lines (30 loc) · 962 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/sh
set -x
DEFAULT_KAFKA_GROUP_ID="restServer"
DEFAULT_KAFKA_RESPONSE_TIMEOUT=20000
env_required() {
echo "EnvironmentVariable $1 is required."
exit 1
}
env_set_default() {
echo "EnvironmentVariable $1 is not set. Defaulting to $2."
}
validateMandatory() {
if [ -z "$KAFKA_BOOTSTRAP_SERVERS" ]; then
env_required "KAFKA_BOOTSTRAP_SERVERS"
fi
}
setDefaults() {
if [ -z "$KAFKA_GROUP_ID" ]; then
export KAFKA_GROUP_ID=${DEFAULT_KAFKA_GROUP_ID}
env_set_default "KAFKA_GROUP_ID" "$DEFAULT_KAFKA_GROUP_ID"
fi
if [ -z "$KAFKA_RESPONSE_TIMEOUT" ]; then
export KAFKA_RESPONSE_TIMEOUT=${DEFAULT_KAFKA_RESPONSE_TIMEOUT}
env_set_default "KAFKA_RESPONSE_TIMEOUT" "$DEFAULT_KAFKA_RESPONSE_TIMEOUT"
fi
}
validateMandatory
setDefaults
# Run the service
java -Dkafka.groupId=${KAFKA_GROUP_ID} -Dkafka.responseTimeout=${KAFKA_RESPONSE_TIMEOUT} -Dkafka.bootstrapServers=${KAFKA_BOOTSTRAP_SERVERS} -jar server-0.3.0-SNAPSHOT.jar