Add support of bunkerweb part 2
This commit is contained in:
30
bin/v-bunkerweb-module
Normal file → Executable file
30
bin/v-bunkerweb-module
Normal file → Executable file
@@ -70,17 +70,16 @@ when :add
|
||||
begin
|
||||
api = HestiaBunkerWebApi.new("http://127.0.0.1:8888")
|
||||
existing_services = api.list_services()
|
||||
if existing_services.nil? || existing_services.strip.empty?
|
||||
if existing_services.nil?
|
||||
result_arr = []
|
||||
else
|
||||
services_data = JSON.parse(existing_services)
|
||||
if services_data["services"]
|
||||
if services_data["services"].any? { |s| s["id"] == v_domain }
|
||||
if existing_services["services"]
|
||||
if existing_services["services"].any? { |s| s["id"] == v_domain }
|
||||
hestia_print_error_message_to_cli "domain already exists"
|
||||
log_event E_EXISTS, $ARGUMENTS
|
||||
exit 1
|
||||
end
|
||||
result_arr = services_data["services"]
|
||||
result_arr = existing_services["services"]
|
||||
else
|
||||
result_arr = []
|
||||
end
|
||||
@@ -109,12 +108,11 @@ when :delete
|
||||
begin
|
||||
api = HestiaBunkerWebApi.new("http://127.0.0.1:8888")
|
||||
existing_services = api.list_services()
|
||||
if existing_services.nil? || existing_services.strip.empty?
|
||||
if existing_services.nil?
|
||||
result_arr = []
|
||||
else
|
||||
services_data = JSON.parse(existing_services)
|
||||
if services_data["services"]
|
||||
result_arr = services_data["services"]
|
||||
if existing_services["services"]
|
||||
result_arr = existing_services["services"]
|
||||
else
|
||||
result_arr = []
|
||||
end
|
||||
@@ -146,12 +144,11 @@ when :addssl, :updssl
|
||||
begin
|
||||
api = HestiaBunkerWebApi.new("http://127.0.0.1:8888")
|
||||
existing_services = api.list_services()
|
||||
if existing_services.nil? || existing_services.strip.empty?
|
||||
if existing_services.nil?
|
||||
result_arr = []
|
||||
else
|
||||
services_data = JSON.parse(existing_services)
|
||||
if services_data["services"]
|
||||
result_arr = services_data["services"]
|
||||
if existing_services["services"]
|
||||
result_arr = existing_services["services"]
|
||||
else
|
||||
result_arr = []
|
||||
end
|
||||
@@ -174,12 +171,11 @@ when :list
|
||||
begin
|
||||
api = HestiaBunkerWebApi.new("http://127.0.0.1:8888")
|
||||
existing_services = api.list_services()
|
||||
if existing_services.nil? || existing_services.strip.empty?
|
||||
if existing_services.nil?
|
||||
result_arr = []
|
||||
else
|
||||
services_data = JSON.parse(existing_services)
|
||||
if services_data["services"]
|
||||
result_arr = services_data["services"]
|
||||
if existing_services["services"]
|
||||
result_arr = existing_services["services"]
|
||||
else
|
||||
result_arr = []
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user