Update nginx_proxy_manager_cli.sh

+ Fix minor typo
+ Add color enabled
This commit is contained in:
Erreur32 2024-07-11 12:36:09 +02:00 committed by GitHub
parent a213bfc046
commit 3324b9ce0c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -375,24 +375,6 @@ delete_proxy_host() {
fi
}
# Function to list all proxy hosts (simple)
list_proxy_hosts_old() {
echo "List of proxy hosts..."
RESPONSE=$(curl -s -X GET "$BASE_URL/nginx/proxy-hosts" \
-H "Authorization: Bearer $(cat $TOKEN_FILE)")
echo "$RESPONSE" | jq -r '.[] | "\(.id) \(.domain_names | join(", ")) \(.enabled)"' | while read -r id domain enabled; do
if [ "$enabled" = "true" ]; then
status="${COLOR_GREEN}enabled${COLOR_RESET}"
else
# status="${COLOR_RED}disabled${COLOR_RESET}"
status="disabled"
fi
printf " id: ${COLOR_YELLOW}%-4s${COLOR_RESET} ${COLOR_GREEN}%-40s${COLOR_RESET} %b\n" "$id" "$domain" "$status"
done
}
# Function to list all proxy hosts (simple)
list_proxy_hosts() {
echo -e "\n${COLOR_ORANGE} List of proxy hosts (simple)${COLOR_RESET}"
@ -401,7 +383,7 @@ list_proxy_hosts() {
echo "$RESPONSE" | jq -r '.[] | "\(.id) \(.domain_names | join(", ")) \(.enabled)"' | while read -r id domain enabled; do
if [ "$enabled" -eq 1 ]; then
status="[${WHITE_ON_GREEN}enabled ${COLOR_RESET}]"
status="[${WHITE_ON_GREEN}enabled${COLOR_RESET}]"
else
status="[${COLOR_RED}disabled${COLOR_RESET}]"
fi