imbajin commented on code in PR #2952:
URL: 
https://github.com/apache/incubator-hugegraph/pull/2952#discussion_r2837740424


##########
hugegraph-server/hugegraph-dist/docker/docker-entrypoint.sh:
##########
@@ -15,32 +15,66 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
+set -euo pipefail
 
-# create a folder to save the docker-related file
-DOCKER_FOLDER='./docker'
-mkdir -p $DOCKER_FOLDER
-
+DOCKER_FOLDER="./docker"
 INIT_FLAG_FILE="init_complete"
+GRAPH_CONF="./conf/graphs/hugegraph.properties"
+
+mkdir -p "${DOCKER_FOLDER}"
+
+log() { echo "[hugegraph-server-entrypoint] $*"; }
+
+fail_on_deprecated() {
+    local old_name="$1" new_name="$2"
+    if [[ -n "${!old_name:-}" ]]; then
+        echo "ERROR: deprecated env '${old_name}' detected. Use '${new_name}' 
instead." >&2
+        exit 2
+    fi
+}
+
+set_prop() {
+    local key="$1" val="$2" file="$3"
+    if grep -q -E "^[[:space:]]*${key}[[:space:]]*=" "${file}"; then
+        sed -ri "s#^([[:space:]]*${key}[[:space:]]*=).*#\\1${val}#" "${file}"
+    else
+        echo "${key}=${val}" >> "${file}"
+    fi
+}
 
-if [ ! -f "${DOCKER_FOLDER}/${INIT_FLAG_FILE}" ]; then
-    # wait for storage backend
-    ./bin/wait-storage.sh
-    if [ -z "$PASSWORD" ]; then
-        echo "init hugegraph with non-auth mode"
+# ── Guard deprecated vars ─────────────────────────────────────────────
+fail_on_deprecated "BACKEND"  "HG_SERVER_BACKEND"

Review Comment:
   ⚠️ **Important: hard-failing deprecated env vars can create avoidable 
upgrade breakage**
   
   Current behavior exits when legacy env names are present (`BACKEND`, 
`PD_PEERS`), even when values are valid. This is strict but can disrupt 
existing users upgrading old compose/manifests.
   
   A smoother migration path is to map old names to new names with warnings, 
then enforce hard-fail in a later release.
   
   ```suggestion
   migrate_env() {
       local old_name="$1" new_name="$2"
       if [[ -n "${!old_name:-}" && -z "${!new_name:-}" ]]; then
           log "WARN: deprecated env '${old_name}' detected; mapping to 
'${new_name}'"
           export "${new_name}=${!old_name}"
       fi
   }
   
   migrate_env "BACKEND"  "HG_SERVER_BACKEND"
   migrate_env "PD_PEERS" "HG_SERVER_PD_PEERS"
   ```
   
   Please consider the same compatibility behavior for PD/Store entrypoints for 
consistency.



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to