support setting the secret in env vars

Signed-off-by: fbt <fbt@fleshless.org>
This commit is contained in:
Jack L. Frost 2019-11-26 01:46:00 +03:00
parent bfbd899554
commit 7858829ec4

3
ufw
View File

@ -56,6 +56,7 @@ usage() {
Environment variables: Environment variables:
UFW_CFG_FILE # Config file to read, defaults to \$XDG_CONFIG_DIR/ufw UFW_CFG_FILE # Config file to read, defaults to \$XDG_CONFIG_DIR/ufw
UFW_SECRET # Your API secret
EOF EOF
} }
@ -359,6 +360,8 @@ 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_DIR/ufw"} cfg_file=${UFW_CFG_FILE:-"$XDG_CONFIG_DIR/ufw"}
[[ $UFW_SECRET ]] && secret=$UFW_SECRET
[[ $1 ]] || { usage; return 1; } [[ $1 ]] || { usage; return 1; }
if [[ -f "$cfg_file" ]]; then if [[ -f "$cfg_file" ]]; then