services: Refactor goimapnotify default variables

This commit is contained in:
Marty Oehme 2025-10-18 12:58:43 +02:00
parent 9548bb3441
commit 72f0651bd9
Signed by: Marty
GPG key ID: 4E535BC19C61886E

View file

@ -3,8 +3,8 @@
# CONFIG_FILE = full path to goimapnotify config file to be used # CONFIG_FILE = full path to goimapnotify config file to be used
# PROFILE = name of yaml file in goimapnotify config dir (without extension) # PROFILE = name of yaml file in goimapnotify config dir (without extension)
# THROTTLE_RATE = amount of time to wait before retrying if connection fails # THROTTLE_RATE = amount of time to wait before retrying if connection fails
DEFAULT_PROFILE="goimapnotify" PROFILE="goimapnotify"
DEFAULT_THROTTLE_RATE=10 THROTTLE_RATE=10
set -e set -e
@ -15,17 +15,16 @@ if [ "$CONFIG_FILE" != "" ]; then
config_path="$CONFIG_FILE" config_path="$CONFIG_FILE"
else else
config_dir="${XDG_CONFIG_HOME:-$HOME/.config}" config_dir="${XDG_CONFIG_HOME:-$HOME/.config}"
config_path="${config_dir}/goimapnotify/${PROFILE:-$DEFAULT_PROFILE}.yaml" config_path="${config_dir}/goimapnotify/${PROFILE}.yaml"
fi fi
# Throttle before running watcher # Throttle before running watcher
snooze -H /1 -M /1 -S /1 -t timefile -T "${THROTTLE_RATE:-$DEFAULT_THROTTLE_RATE}" || exit 1 snooze -H /1 -M /1 -S /1 -t timefile -T "${THROTTLE_RATE}" || exit 1
touch timefile touch timefile
if [ ! -f "$config_path" ]; then if [ ! -f "$config_path" ]; then
echo "Config path not found: $config_path" echo "goimapnotify config path not found: $config_path"
exit 1 exit 1
fi fi
echo "starting program"
exec chpst -e "$TURNSTILE_ENV_DIR" goimapnotify -conf "$config_path" 2>&1 exec chpst -e "$TURNSTILE_ENV_DIR" goimapnotify -conf "$config_path" 2>&1