fork 0k-charms
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

28 lines
777 B

#!/bin/bash
set -e
OPTS=(
host
port
connection-security
auth-method
)
for var in "${OPTS[@]}"; do
value=$(options-get "$var") && relation-set "$var" "$value" || exit 1
case "$var:$value" in
auth-method:password)
login=$(options-get "login") || {
err "${WHITE}login${NORMAL} value is required when ${WHITE}auth-method${NORMAL} is set to \"password\""
exit 1
}
password=$(options-get "password") || {
err "${WHITE}password${NORMAL} value is required when ${WHITE}auth-method${NORMAL} is set to \"password\""
exit 1
}
relation-set login "$login"
relation-set password "$password"
;;
esac
done