feat(shell-sync): validate_settings() part 3/3
This commit is contained in:
1 parent
1f9e716ed0
commit
8312c2c6d3
1 file changed
+21
@@ -72,3 +72,24 @@ validate_settings() {
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ "$NOTIFY_MODE" != "none" ]; then
|
||||
if [ -z "$SMTP_HOST" ] || [ -z "$SMTP_FROM" ] || [ -z "$SMTP_TO" ]; then
|
||||
log "Configuration error: SMTP_HOST, SMTP_FROM, and SMTP_TO are required when notifications are enabled"
|
||||
return 1
|
||||
fi
|
||||
if ! [[ "$SMTP_PORT" =~ ^[1-9][0-9]*$ ]]; then
|
||||
log "Configuration error: SMTP_PORT must be a valid port number"
|
||||
return 1
|
||||
fi
|
||||
if { [ -n "$SMTP_USER" ] && [ -z "$SMTP_PASS" ]; } || { [ -z "$SMTP_USER" ] && [ -n "$SMTP_PASS" ]; }; then
|
||||
log "Configuration error: SMTP_USER and SMTP_PASS must either both be set or both be empty"
|
||||
return 1
|
||||
fi
|
||||
case "$SMTP_TLS" in starttls|tls|none) ;; *)
|
||||
log "Configuration error: SMTP_TLS must be starttls, tls, or none"
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user