#!/usr/bin/env bash

# This wrapper script allows SystemD to feed a file containing a passphrase into
# the main OpenSearch startup script

set -e -o pipefail

if [ -n "$OPENSEARCH_KEYSTORE_PASSPHRASE_FILE" ] ; then
  exec /usr/share/opensearch/bin/opensearch "$@" < "$OPENSEARCH_KEYSTORE_PASSPHRASE_FILE"
else
  exec /usr/share/opensearch/bin/opensearch "$@"
fi
