|
4 | 4 | # Github [ https://github.com/Erreur32/nginx-proxy-manager-Bash-API ] |
5 | 5 | # Erreur32 July 2024 |
6 | 6 |
|
7 | | -VERSION="2.5.0" |
| 7 | +VERSION="2.5.1" |
8 | 8 |
|
9 | 9 | # |
10 | 10 | # This script allows you to manage Nginx Proxy Manager via the API. It provides |
@@ -89,7 +89,6 @@ API_PASS="pass nginx" |
89 | 89 | # Path to store .txt files and Backups |
90 | 90 | BASE_DIR="/path/nginx_proxy_script/data" |
91 | 91 |
|
92 | | - |
93 | 92 | ################################# |
94 | 93 | # Variables to Edit (optional) # |
95 | 94 | ################################# |
@@ -233,7 +232,7 @@ usage() { |
233 | 232 | echo -e " --generate-cert domain email 🌀 ${COLOR_GREEN}Generate${COLOR_RESET} Certificate for the given '${COLOR_YELLOW}domain${COLOR_RESET}' and '${COLOR_YELLOW}email${COLOR_RESET}'" |
234 | 233 | echo -e " --delete-cert domain 💣 ${COLOR_ORANGE}Delete${COLOR_RESET} Certificate for the given '${COLOR_YELLOW}domain${COLOR_RESET}' " |
235 | 234 |
|
236 | | - echo -e " --examples 🔖 Examples commands, more explicits" |
| 235 | + echo -e " --examples 🔖 Examples commands, more explicits" |
237 | 236 | echo -e " --help" |
238 | 237 | echo "" |
239 | 238 | exit 0 |
@@ -478,6 +477,12 @@ while getopts "d:i:p:f:c:b:w:a:l:-:" opt; do |
478 | 477 | host-ssl-enable) |
479 | 478 | ENABLE_SSL=true |
480 | 479 | HOST_ID="${!OPTIND}"; shift |
| 480 | + # Check if HOST_ID is provided |
| 481 | + if [ -z "$HOST_ID" ]; then |
| 482 | + echo -e " \n⛔ ${COLOR_RED}Error: Missing host ID for --host-ssl-enable.${COLOR_RESET}" |
| 483 | + echo -e " To find ID Check with ${COLOR_ORANGE}$0 --host-list${COLOR_RESET}\n" |
| 484 | + exit 1 |
| 485 | + fi |
481 | 486 | ;; |
482 | 487 | host-ssl-disable) |
483 | 488 | DISABLE_SSL=true |
@@ -1393,9 +1398,12 @@ enable_ssl_old() { |
1393 | 1398 | enable_ssl() { |
1394 | 1399 | if [ -z "$HOST_ID" ]; then |
1395 | 1400 | echo -e "\n 🛡️ The --host-ssl-enable option requires a host ID." |
1396 | | - usage |
| 1401 | + echo -e " --host-ssl-enable id 🔒 ${COLOR_GREEN}Enable${COLOR_RESET} SSL, HTTP/2, and HSTS for a proxy host (Enabled only if exist, check ${COLOR_ORANGE}--generate-cert${COLOR_RESET} to create one)" |
| 1402 | + #usage # Call usage function to show correct usage |
| 1403 | + exit 1 # Exit if no HOST_ID is provided |
1397 | 1404 | fi |
1398 | 1405 |
|
| 1406 | + |
1399 | 1407 | # Validate that HOST_ID is a number |
1400 | 1408 | if ! [[ "$HOST_ID" =~ ^[0-9]+$ ]]; then |
1401 | 1409 | echo -e " ⛔ ${COLOR_RED}Invalid host ID: $HOST_ID. It must be a numeric value.${COLOR_RESET}\n" |
|
0 commit comments