override the config with env

Signed-off-by: fbt <fbt@fleshless.org>
This commit is contained in:
2026-11-28 00:41:59 +00:00
parent e4bda03b70
commit 0c13f8bd8b
+4 -4
View File
@@ -356,10 +356,6 @@ main() {
cfg_url_regex='^[A-Za-z]([A-Za-z0-9+.-]+)?://.+' cfg_url_regex='^[A-Za-z]([A-Za-z0-9+.-]+)?://.+'
cfg_file=${UFW_CFG_FILE:-"$XDG_CONFIG_HOME/ufw"} cfg_file=${UFW_CFG_FILE:-"$XDG_CONFIG_HOME/ufw"}
[[ $UFW_SECRET ]] && secret=$UFW_SECRET
[[ $UFW_TMP_DIR ]] && cfg_tmp_dir=$UFW_TMP_DIR
[[ $UFW_URL ]] && cfg_service_url=$UFW_URL
[[ $1 ]] || { usage; return 1; } [[ $1 ]] || { usage; return 1; }
if [[ -f "$cfg_file" ]]; then if [[ -f "$cfg_file" ]]; then
@@ -369,6 +365,10 @@ main() {
fi fi
fi fi
[[ $UFW_SECRET ]] && secret=$UFW_SECRET
[[ $UFW_TMP_DIR ]] && cfg_tmp_dir=$UFW_TMP_DIR
[[ $UFW_URL ]] && cfg_service_url=$UFW_URL
# Defaults # Defaults
: ${cfg_file:="$XDG_CONFIG_HOME/ufw"} : ${cfg_file:="$XDG_CONFIG_HOME/ufw"}
: ${cfg_tmp_dir:="$XDG_RUNTIME_DIR/ufw"} : ${cfg_tmp_dir:="$XDG_RUNTIME_DIR/ufw"}