moresandeep commented on code in PR #1187:
URL: https://github.com/apache/knox/pull/1187#discussion_r2997785715


##########
gateway-docker/src/main/resources/docker/gateway-entrypoint.sh:
##########
@@ -56,6 +59,22 @@ importMultipleCerts() {
   done
 }
 
+## Helper function to save an alias
+## Function takes alias name, environment variable value, and optional default 
value
+saveAlias() {
+  local alias_name=$1
+  local env_var_value=$2
+  local default_value=$3
+
+  if [[ -n ${env_var_value} ]]; then
+    echo "Creating alias ${alias_name} using provided value..."

Review Comment:
   If we have passwords in the value this will get logged :( 



##########
gateway-docker/src/main/resources/docker/gateway-entrypoint.sh:
##########
@@ -78,16 +97,14 @@ then
   LDAP_BIND_PASSWORD=$(/bin/cat "${LDAP_PASSWORD_FILE}" 2>/dev/null)
 fi
 
-if [[ -n ${LDAP_BIND_PASSWORD} ]]
-then
-  echo "Using provided LDAP bind password"
-  /home/knox/knox/bin/knoxcli.sh create-alias ldap-bind-password --value 
"${LDAP_BIND_PASSWORD}"
-fi
+saveAlias ldap-bind-password "${LDAP_BIND_PASSWORD}"

Review Comment:
   There is no default value provided, I think that is okay



##########
gateway-docker/src/main/resources/docker/gateway-entrypoint.sh:
##########
@@ -56,6 +59,22 @@ importMultipleCerts() {
   done
 }
 
+## Helper function to save an alias
+## Function takes alias name, environment variable value, and optional default 
value
+saveAlias() {
+  local alias_name=$1
+  local env_var_value=$2
+  local default_value=$3
+
+  if [[ -n ${env_var_value} ]]; then
+    echo "Creating alias ${alias_name} using provided value..."
+    /home/knox/knox/bin/knoxcli.sh create-alias "${alias_name}" --value 
"${env_var_value}"
+  elif [[ -n ${default_value} ]]; then
+    echo "Creating alias ${alias_name} using default value..."

Review Comment:
   Same here.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to