bitflicker64 commented on code in PR #3119:
URL: https://github.com/apache/hugegraph/pull/3119#discussion_r3658493137
##########
hugegraph-server/hugegraph-dist/docker/docker-entrypoint.sh:
##########
@@ -54,19 +91,89 @@ migrate_env "PD_PEERS" "HG_SERVER_PD_PEERS"
# ── Map env → properties file ─────────────────────────────────────────
[[ -n "${HG_SERVER_BACKEND:-}" ]] && set_prop "backend"
"${HG_SERVER_BACKEND}" "${GRAPH_CONF}"
[[ -n "${HG_SERVER_PD_PEERS:-}" ]] && set_prop "pd.peers"
"${HG_SERVER_PD_PEERS}" "${GRAPH_CONF}"
+if [[ -n "${HG_SERVER_INIT_STORE_ENABLED:-}" ]]; then
+ # Canonicalize before writing, so the property file only ever holds `true`
+ # or `false` and cannot be read differently by the shell and the server
+ if ! HG_SERVER_INIT_STORE_ENABLED=$(to_bool
"${HG_SERVER_INIT_STORE_ENABLED}"); then
+ log "ERROR: HG_SERVER_INIT_STORE_ENABLED must be a boolean, got
'${HG_SERVER_INIT_STORE_ENABLED}'"
+ exit 1
+ fi
+ set_prop "init_store.enabled" "${HG_SERVER_INIT_STORE_ENABLED}"
"${REST_SERVER_CONF}"
Review Comment:
Confirmed and fixed in 3cb4fda2. `set_prop` now matches the same `=`, `:`
and whitespace separators as `get_prop` and collapses every existing definition
into one canonical `key=value` line, leaving comments alone. Rewrote it in awk
so the key and value are matched and emitted literally, with no regex escaping.
Worth noting it is worse than a stale read: a duplicated key fails the
scalar type check while the config is still loading, so `new HugeConfig(...)`
throws `Invalid value for key 'init_store.enabled': '[false, true]'` and both
init-store and server startup fail outright. Pinned that with a test that loads
a duplicated key through `HugeConfig`.
Entrypoint coverage added for a colon-form override, a whitespace-form
override, a colon-form `auth.admin_pa` overridden by `PASSWORD`, and that
commented defaults are not counted as definitions.
--
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]