forked from mimuret/dtap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathentrypoint.sh
executable file
·94 lines (90 loc) · 2.54 KB
/
entrypoint.sh
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#!/bin/ash
if [ ! -e "/etc/dtap/dtap.conf" ] ; then
if [ "${DTAP_INPUT_UNIX_SOCKET}" != "" ] ; then
cat <<- EOS >> /etc/dtap/dtap.conf
[[InputUnix]]
Path="${DTAP_INPUT_UNIX_SOCKET}"
User="${DTAP_INPUT_UNIX_SOCKET_USER}"
EOS
fi
if [ "${DTAP_INPUT_TCP_LISTEN_ADDR}" != "" ] ; then
cat <<- EOS >> /etc/dtap/dtap.conf
[[InputTCP]]
Address="${DTAP_INPUT_TCP_LISTEN_ADDR}"
Port=${DTAP_INPUT_TCP_LISTEN_PORT}
EOS
fi
if [ "${DTAP_OUTPUT_TCP_HOST}" != "" ] ; then
cat <<- EOS >> /etc/dtap/dtap.conf
[[OutputTCP]]
Host="${DTAP_OUTPUT_TCP_HOST}"
Port=${DTAP_OUTPUT_TCP_PORT}
EOS
fi
if [ "$DTAP_OUTPUT_UNIX_SOCKET" != "" ] ; then
cat <<- EOS >> /etc/dtap/dtap.conf
[[OutputUnix]]
Path="${DTAP_OUTPUT_UNIX_SOCKET}"
EOS
fi
if [ "${DTAP_OUTPUT_FLUENT_HOST}" != "" ] ; then
cat <<- EOS >> /etc/dtap/dtap.conf
[[OutputFluent]]
Host = "${DTAP_OUTPUT_FLUENT_HOST}"
Port = ${DTAP_OUTPUT_FLUENT_PORT}
Tag = "${DTAP_OUTPUT_FLUENT_TAG}"
[OutputFluent.flat]
IPv4Mask = ${DTAP_IPV4_MASK}
IPv6Mask = ${DTAP_IPV6_MASK}
EnableECS = ${DTAP_ENABLE_ECS}
EnableHashIP = ${DTAP_ENABLE_HASH_IP}
IPHashSaltPath = "${DTAP_HASH_SALT}"
EOS
fi
if [ "${DTAP_OUTPUT_KAFKA_HOSTS}" != "" ] ; then
host=$(echo ${DTAP_OUTPUT_KAFKA_HOSTS} | sed 's/,/","/g')
cat <<- EOS >> /etc/dtap/dtap.conf
[[OutputKafka]]
Hosts = ["${host}"]
${registries}
Topic = "${DTAP_OUTPUT_KAFKA_TOPIC}"
EOS
if [ "${DTAP_OUTPUT_SCHEMA_REGISTRIES}" != "" ] ; then
r=$(echo ${DTAP_OUTPUT_SCHEMA_REGISTRIES} | sed 's/,/","/g')
cat <<- EOS >> /etc/dtap/dtap.conf
SchemaRegistries = ["${r}"]
EOS
fi
fi
if [ "${DTAP_OUTPUT_NATS_HOST}" != "" ] ; then
cat <<- EOS >> /etc/dtap/dtap.conf
[[OutputNats]]
Hosts = "${DTAP_OUTPUT_NATS_HOST}"
User = "${DTAP_OUTPUT_NATS_USER}"
Password = "${DTAP_OUTPUT_NATS_PASS}"
Token = "${DTAP_OUTPUT_NATS_TOKEN}"
Subject = "${DTAP_OUTPUT_NATS_SUBJECT}"
[OutputNats.flat]
IPv4Mask = ${DTAP_IPV4_MASK}
IPv6Mask = ${DTAP_IPV6_MASK}
EnableECS = ${DTAP_ENABLE_ECS}
EnableHashIP = ${DTAP_ENABLE_HASH_IP}
IPHashSaltPath = "${DTAP_HASH_SALT}"
EOS
fi
if [ "${DTAP_OUTPUT_STDOUT_TYPE}" != "" ] ; then
cat <<- EOS >> /etc/dtap/dtap.conf
[[OutputStdout]]
Type = "${DTAP_OUTPUT_STDOUT_TYPE}"
Template = "${DTAP_OUTPUT_STDOUT_TEMPLATE}"
[OutputStdout.flat]
IPv4Mask = ${DTAP_IPV4_MASK}
IPv6Mask = ${DTAP_IPV6_MASK}
EnableECS = ${DTAP_ENABLE_ECS}
EnableHashIP = ${DTAP_ENABLE_HASH_IP}
IPHashSaltPath = "${DTAP_HASH_SALT}"
EOS
fi
fi
cat /etc/dtap/dtap.conf
exec "$@"