Skip to content

Commit 5db84d1

Browse files
authored
Allow setting KEYSTORE_PASSWORD through env variable (opensearch-project#12865)
1 parent 1d1d370 commit 5db84d1

File tree

3 files changed

+16
-10
lines changed

3 files changed

+16
-10
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
105105
### Added
106106
- Convert ingest processor supports ip type ([#12818](https://github.com/opensearch-project/OpenSearch/pull/12818))
107107
- Add a counter to node stat api to track shard going from idle to non-idle ([#12768](https://github.com/opensearch-project/OpenSearch/pull/12768))
108+
- Allow setting KEYSTORE_PASSWORD through env variable ([#12865](https://github.com/opensearch-project/OpenSearch/pull/12865))
108109
- [Concurrent Segment Search] Perform buildAggregation concurrently and support Composite Aggregations ([#12697](https://github.com/opensearch-project/OpenSearch/pull/12697))
109110

110111
### Dependencies

distribution/src/bin/opensearch

+7-5
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,16 @@ fi
3636

3737
# get keystore password before setting java options to avoid
3838
# conflicting GC configurations for the keystore tools
39-
unset KEYSTORE_PASSWORD
40-
KEYSTORE_PASSWORD=
4139
if [[ $CHECK_KEYSTORE = true ]] \
4240
&& bin/opensearch-keystore has-passwd --silent
4341
then
44-
if ! read -s -r -p "OpenSearch keystore password: " KEYSTORE_PASSWORD ; then
45-
echo "Failed to read keystore password on console" 1>&2
46-
exit 1
42+
if [[ ! -z "${KEYSTORE_PASSWORD}" ]]; then
43+
echo "Using value of KEYSTORE_PASSWORD from the environment"
44+
else
45+
if ! read -s -r -p "OpenSearch keystore password: " KEYSTORE_PASSWORD ; then
46+
echo "Failed to read keystore password on console" 1>&2
47+
exit 1
48+
fi
4749
fi
4850
fi
4951

distribution/src/bin/opensearch.bat

+8-5
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,17 @@ if not exist "%SERVICE_LOG_DIR%" (
6262
mkdir "%SERVICE_LOG_DIR%"
6363
)
6464

65-
SET KEYSTORE_PASSWORD=
6665
IF "%checkpassword%"=="Y" (
6766
CALL "%~dp0opensearch-keystore.bat" has-passwd --silent
6867
IF !ERRORLEVEL! EQU 0 (
69-
SET /P KEYSTORE_PASSWORD=OpenSearch keystore password:
70-
IF !ERRORLEVEL! NEQ 0 (
71-
ECHO Failed to read keystore password on standard input
72-
EXIT /B !ERRORLEVEL!
68+
if defined KEYSTORE_PASSWORD (
69+
ECHO Using value of KEYSTORE_PASSWORD from the environment
70+
) else (
71+
SET /P KEYSTORE_PASSWORD=OpenSearch keystore password:
72+
IF !ERRORLEVEL! NEQ 0 (
73+
ECHO Failed to read keystore password on standard input
74+
EXIT /B !ERRORLEVEL!
75+
)
7376
)
7477
)
7578
)

0 commit comments

Comments
 (0)