浏览代码

fix(bin/eqmx): do not rely on existing user name

Container should be able to run as other user too. Use uid as fallback.
Prerequisite to be able to run as user specified during startup.
Igor Urminček 2 年之前
父节点
当前提交
3609b20fb2
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      bin/emqx

+ 1 - 1
bin/emqx

@@ -48,7 +48,7 @@ RUNNER_SCRIPT="$RUNNER_BIN_DIR/$REL_NAME"
 CODE_LOADING_MODE="${CODE_LOADING_MODE:-embedded}"
 REL_DIR="$RUNNER_ROOT_DIR/releases/$REL_VSN"
 
-WHOAMI=$(whoami)
+WHOAMI=$(whoami 2>/dev/null || id -u)
 
 # hocon try to read environment variables starting with "EMQX_"
 export HOCON_ENV_OVERRIDE_PREFIX='EMQX_'