Default to _local when node not supplied

This commit is contained in:
shyelc
2025-10-30 07:27:52 +00:00
parent 294ebf0c31
commit 41a112cd8a

View File

@@ -13,23 +13,8 @@ if [[ -z "$password" ]]; then
exit 1
fi
if [[ -z "$node" ]]; then
echo "INFO: Node missing, trying to detect..."
node=$(curl -X GET "${hostname}/_membership" --user "${username}:${password}" | jq -r '.cluster_nodes[0] // .all_nodes[0]')
if [[ -n "$node" ]]; then
echo "INFO: Detected node: $node"
# confirm
while true; do
read -p "May we use this node? (defaultly, it may be 'node@nohost') " yn
case $yn in
[Yy]* ) break;;
[Nn]* ) exit 1;;
* ) echo "Please answer yes or no.";;
esac
done
else
echo "ERROR: Node missing (default should be located in /opt/couchdb/etc/vm.args under -name)"
exit 1
fi
echo "INFO: defaulting to _local"
node=_local
fi
echo "-- Configuring CouchDB by REST APIs... -->"