-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow absolute paths in HAZELCAST_CONFIG environment variable #19908
Conversation
if [ -z "$HAZELCAST_CONFIG" ]; then | ||
HAZELCAST_CONFIG="config/hazelcast.xml" | ||
HAZELCAST_CONFIG="$HAZELCAST_HOME/config/hazelcast.xml" | ||
else |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can avoid nesting conditions: in the first if
you can leave the code as it was and simply add another if
below:
if [ -z "$HAZELCAST_CONFIG" ]; then
HAZELCAST_CONFIG="config/hazelcast.xml"
fi
# if the first character is /, then this is an absolute path, use as is
# otherwise prepend (HAZELCAST_HOME)
if [ "${HAZELCAST_CONFIG:0:1}" != "/" ]; then
HAZELCAST_CONFIG="$HAZELCAST_HOME/$HAZELCAST_CONFIG"
fi
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense. Updated at: cda27a4
if [ -z "$HAZELCAST_CONFIG" ]; then | ||
HAZELCAST_CONFIG="config/hazelcast.xml" | ||
HAZELCAST_CONFIG="$HAZELCAST_HOME/config/hazelcast.xml" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't have to duplicate here how the HAZELCAST_CONFIG
is resolved. HAZELCAST_HOME
will be added by the condition below :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, fixed at: 8e5e8f0
The job Click to expand the log file-------------------------- -------TEST FAILURE------- -------------------------- [INFO] Results: [INFO] [ERROR] Failures: [ERROR] QueueStatisticsTest.testAge:170 expected:<4611686018427387903> but was:<0> [ERROR] QueueStatisticsTest.testAge:170 expected:<4611686018427387903> but was:<0> [INFO] [ERROR] Tests run: 46513, Failures: 2, Errors: 0, Skipped: 1012 [INFO] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work!
The job Click to expand the log file-------------------------- -------TEST FAILURE------- -------------------------- [INFO] Results: [INFO] [ERROR] Failures: [ERROR] QueueStatisticsTest.testAge:170 expected:<4611686018427387903> but was:<0> [INFO] [ERROR] Tests run: 46513, Failures: 1, Errors: 0, Skipped: 1012 [INFO] |
The job Click to expand the log file-------------------------- -------TEST FAILURE------- -------------------------- [INFO] Results: [INFO] [ERROR] Failures: [ERROR] QueueStatisticsTest.testAge:170 expected:<4611686018427387903> but was:<0> [ERROR] QueueStatisticsTest.testAge:170 expected:<4611686018427387903> but was:<0> [INFO] [ERROR] Tests run: 46513, Failures: 2, Errors: 0, Skipped: 1012 [INFO] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Could you extend the same logic to HAZELCAST_CLIENT_CONFIG
in hz-cli
file in the same directory?
@frant-hartm Updated at: 9a7e1af @ldziedziul @frant-hartm Thanks for the review! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
…ast#19908) Allow absolute paths in HAZELCAST_CONFIG and HAZELCAST_CLIENT_CONFIG environment variables
* Allow absolute paths in HAZELCAST_CONFIG environment variable (#19908) Allow absolute paths in HAZELCAST_CONFIG and HAZELCAST_CLIENT_CONFIG environment variables * Use hazelcast.yaml when hazelcast.xml is not available Users sometimes prefer to use yaml configuration. When the hazelcast.xml is not available in the config folder then hazelcast.yaml is tried. If hazelcast.yaml is not available error message is shown with guidance what to do. Backport of #20003 and #19908 (for clean backport) Fixes #19727 Co-authored-by: Yüce Tekol <yucetekol@gmail.com>
…ast#19908) Allow absolute paths in HAZELCAST_CONFIG and HAZELCAST_CLIENT_CONFIG environment variables
This PR updates
bin/hz-start
script to allow absolute paths inHAZELCAST_CONFIG
. The following rules are used to determine the actual configuration path:HAZELCAST_CONFIG
is empty or not set:$HAZELCAST_HOME/config/hazelcast.xml
HAZELCAST_CONFIG
is absolute (starts with/
): The configuration path is used as is.$HAZELCAST_HOME/$HAZELCAST_CONFIG
Checklist:
Team:
,Type:
,Source:
,Module:
) and Milestone setAdd to Release Notes
orNot Release Notes content
set@Nonnull/@Nullable
annotations@since
tags in Javadoc