Merge pull request #8486 from zhongwencool/check-conf-cli
feat: add check_conf cli to check config format
This commit is contained in:
commit
d9ca791365
|
@ -21,6 +21,7 @@ File format:
|
|||
|
||||
### Enhancements
|
||||
- HTTP API(GET /rules/) support for pagination and fuzzy filtering. [#8450]
|
||||
- Add check_conf cli to check config format. [#8486]
|
||||
|
||||
## v4.3.16
|
||||
|
||||
|
|
26
bin/emqx
26
bin/emqx
|
@ -196,6 +196,7 @@ usage() {
|
|||
echo " Up/Down-grade: upgrade | downgrade | install | uninstall"
|
||||
echo " Install info: ertspath | root_dir | versions"
|
||||
echo " Runtime info: pid | ping | versions"
|
||||
echo " Config check: check_conf"
|
||||
echo " Advanced: console_clean | escript | rpc | rpcterms | eval"
|
||||
echo ''
|
||||
echo "Execute '$REL_NAME COMMAND help' for more information"
|
||||
|
@ -338,9 +339,12 @@ trim() {
|
|||
|
||||
# Function to generate app.config and vm.args
|
||||
generate_config() {
|
||||
## Delete the *.siz files first or it cann't start after
|
||||
## changing the config 'log.rotation.size'
|
||||
rm -rf "${RUNNER_LOG_DIR}"/*.siz
|
||||
check_only="$1"
|
||||
if [ "$check_only" != "check_only" ]; then
|
||||
## Delete the *.siz files first or it cann't start after
|
||||
## changing the config 'log.rotation.size'
|
||||
rm -rf "${RUNNER_LOG_DIR}"/*.siz
|
||||
fi
|
||||
|
||||
set +e
|
||||
if [ "${EMQX_LICENSE_CONF:-}" = "" ]; then
|
||||
|
@ -392,12 +396,19 @@ generate_config() {
|
|||
fi
|
||||
fi
|
||||
done
|
||||
mv -f "$TMP_ARG_FILE" "$CUTTLE_GEN_ARG_FILE"
|
||||
|
||||
if ! relx_nodetool chkconfig -config "$CONFIG_FILE"; then
|
||||
echoerr "Error reading $CONFIG_FILE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$check_only" = "check_only" ]; then
|
||||
rm -f "$TMP_ARG_FILE"
|
||||
rm -f "$CUTTLE_GEN_ARG_FILE"
|
||||
rm -f "$CONFIG_FILE"
|
||||
else
|
||||
mv -f "$TMP_ARG_FILE" "$CUTTLE_GEN_ARG_FILE"
|
||||
fi
|
||||
}
|
||||
|
||||
# Call bootstrapd for daemon commands like start/stop/console
|
||||
|
@ -451,6 +462,9 @@ case "$1" in
|
|||
foreground)
|
||||
IS_BOOT_COMMAND='yes'
|
||||
;;
|
||||
check_conf)
|
||||
IS_BOOT_COMMAND='yes'
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
|
@ -819,6 +833,10 @@ case "$1" in
|
|||
ertspath)
|
||||
echo "$ERTS_PATH"
|
||||
;;
|
||||
check_conf)
|
||||
generate_config "check_only"
|
||||
echo "$RUNNER_ETC_DIR/emqx.conf is ok"
|
||||
;;
|
||||
|
||||
ctl)
|
||||
assert_node_alive
|
||||
|
|
Loading…
Reference in New Issue