mirror of
https://github.com/eliasstepanik/ark-ac-server-tools.git
synced 2026-01-27 16:58:27 +00:00
Add printconfig command
This new command will print the file that each config option is taken from.
This commit is contained in:
parent
6d207952b5
commit
7f8aa05e80
@ -2088,6 +2088,23 @@ doListAllInstances(){
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
doPrintConfig(){
|
||||||
|
declare -A vars
|
||||||
|
declare -A vals
|
||||||
|
for v in $(eval echo \$\{\!{a..z}\*\} \$\{\!{A..Z}\*\} \$\{\!_\*\}); do
|
||||||
|
vals["$v"]="${!v}"
|
||||||
|
done
|
||||||
|
for cfgfile in "$configfile" "$HOME/.arkmanager.cfg" "/etc/arkmanager/arkmanager.cfg"; do
|
||||||
|
while read v; do
|
||||||
|
val="$(source "$cfgfile"; echo "${!v}")"
|
||||||
|
if [[ "$val" = "${vals[$v]}" && -z "${vars[$v]}" ]]; then
|
||||||
|
vars["$v"]="$cfgfile"
|
||||||
|
echo "${cfgfile} => ${v}"
|
||||||
|
fi
|
||||||
|
done < <(sed -n 's/^[[:space:]]*\([A-Za-z_][A-Za-z0-9_]*\)=.*/\1/p' <"$cfgfile")
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
useConfig() {
|
useConfig() {
|
||||||
configfile=
|
configfile=
|
||||||
if [ -f "/etc/arkmanager/instances/${1}.cfg" ]; then
|
if [ -f "/etc/arkmanager/instances/${1}.cfg" ]; then
|
||||||
@ -2377,6 +2394,9 @@ main(){
|
|||||||
rconcmd)
|
rconcmd)
|
||||||
rconcmd "${args[@]}"
|
rconcmd "${args[@]}"
|
||||||
;;
|
;;
|
||||||
|
printconfig)
|
||||||
|
doPrintConfig
|
||||||
|
;;
|
||||||
status)
|
status)
|
||||||
printStatus
|
printStatus
|
||||||
;;
|
;;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user