Skip to content

Commit

Permalink
#1548 #1519 Update docker entrypoint to include default configuration
Browse files Browse the repository at this point in the history
file and remove prevent cassandra wait if it is not configured
  • Loading branch information
To-om committed Sep 24, 2020
1 parent df8f8e2 commit 30573d8
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions package/docker/entrypoint
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,7 @@ done

if test "${CONFIG}" = 1
then
echo "Waiting until Cassandra DB is up"
sleep 30 # Sleep until cassandra Db is up
CONFIG_FILE=$(mktemp).conf
CONFIG_FILE=$(mktemp --tmpdir thehive-XXXXXX.conf)
if test "${CONFIG_SECRET}" = 1
then
if test -z "${SECRET}"
Expand Down Expand Up @@ -106,18 +104,21 @@ then
echo "storage.directory = \"${BDB_DIRECTORY}\"" >> ${CONFIG_FILE}
echo "berkeleyje.freeDisk = 1" >> ${CONFIG_FILE}
else
echo "Using cassanra address = ${CQL[@]}"
echo "Using cassandra address = ${CQL[@]}"
echo "storage.backend = cql" >> ${CONFIG_FILE}
if [[ -n $CQL_USERNAME && -n $CQL_PASSWORD ]];then
echo "storage.username = \"${CQL_USERNAME}\"" >> ${CONFIG_FILE}
echo "storage.password = \"${CQL_PASSWORD}\"" >> ${CONFIG_FILE}
printf "Using ${CQL_USERNAME} as cassandra username and ${CQL_PASSWORD} as its password\n"
if [[ -n $CQL_USERNAME && -n $CQL_PASSWORD ]]
then
echo "storage.username = \"${CQL_USERNAME}\"" >> ${CONFIG_FILE}
echo "storage.password = \"${CQL_PASSWORD}\"" >> ${CONFIG_FILE}
printf "Using ${CQL_USERNAME} as cassandra username and ${CQL_PASSWORD} as its password\n"
fi
echo "storage.cql.cluster-name = thp" >> ${CONFIG_FILE}
echo "storage.cql.keyspace = thehive" >> ${CONFIG_FILE}
echo "storage.hostname = [" >> ${CONFIG_FILE}
printf '%s\n' "${CQL_HOSTS[@]}" >> ${CONFIG_FILE}
echo "]" >> ${CONFIG_FILE}
echo "Waiting until Cassandra DB is up"
sleep 30 # Sleep until cassandra Db is up
fi
echo "}" >> ${CONFIG_FILE}
fi
Expand Down Expand Up @@ -174,7 +175,7 @@ then
fi
fi

echo "include file(\"secret.conf\")" >> ${CONFIG_FILE}
echo "include file(\"/etc/thehive/application.conf\")" >> ${CONFIG_FILE}
fi

bin/thehive \
Expand Down

0 comments on commit 30573d8

Please sign in to comment.