This commit is contained in:
Alexey Berezhok
2026-05-11 23:28:47 +03:00
parent adef1a98bb
commit 9d1afcdf28
3 changed files with 38 additions and 11 deletions

View File

@@ -7,7 +7,7 @@
# This function enables and disables additional modules
#
# Commands:
# add [domain_name]
# add [domain_name] [ip]
# addssl [domain_name] [SSL_CERT_PATH] [SSL_KEY_PATH]
# delete [domain_name]
# updssl [domain] [SSL_CERT_PATH] [SSL_KEY_PATH]
@@ -59,10 +59,11 @@ case v_command.to_sym
when :add
v_domain = ARGV[1].strip
v_format = ARGV[2] unless ARGV[2].nil?
v_ip = ARGV[2] ? ARGV[2].strip : nil
v_format = ARGV[3] unless ARGV[2].nil?
if v_domain.nil? || v_domain == ""
hestia_print_error_message_to_cli "domain should not be empty"
if v_domain.nil? || v_domain == "" || v_ip.nil? || v_ip == ""
hestia_print_error_message_to_cli "domain and ip should not be empty"
log_event E_ARGS, $ARGUMENTS
exit 1
else
@@ -86,7 +87,7 @@ when :add
end
api.create_service(v_domain, {
ssl: "no",
reverse_proxy_host: "http://127.0.0.1:#{$PROXY_PORT}"
reverse_proxy_host: "http://#{v_ip}:#{$PROXY_PORT}"
})
rescue BunkerWebApiError => e
hestia_print_error_message_to_cli "[ERROR] Ошибка API: #{e.message}"