From 5b858424ab6e03235f3d0b077e95be4641006667 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Thu, 14 Apr 2022 19:23:27 -0400 Subject: [PATCH] Fix opensearch-env always sources the environment from hardcoded file (#875) (#2908) backport commit https://github.com/opensearch-project/OpenSearch/commit/e3d86baa5a97a813072cb3d5fe9b466d31a44f31 to 1.x branch distribution/bin/opensearch-env always sources the environment from the default environment file /etc/default/opensearch. This is an issue if we want to run multiple instances of OpenSearch on the same host. This change lets users override the default behavior by not sourcing the default environment file in case OPENSEARCH_PATH_CONF is set. Signed-off-by: xuezhou25 --- distribution/src/bin/opensearch-env | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/distribution/src/bin/opensearch-env b/distribution/src/bin/opensearch-env index 7a5c1267a2ae7..f9d8e607b7d5b 100644 --- a/distribution/src/bin/opensearch-env +++ b/distribution/src/bin/opensearch-env @@ -81,7 +81,9 @@ fi export HOSTNAME=$HOSTNAME -${source.path.env} +if [ -z "$OPENSEARCH_PATH_CONF" ]; then + ${source.path.env} +fi if [ -z "$OPENSEARCH_PATH_CONF" ]; then echo "OPENSEARCH_PATH_CONF must be set to the configuration path"