Class: Hoverfly
Class Attribute Summary collapse
Class Method Summary
collapse
clear_cached_data, get_cached_data, get_config_info, get_current_destination, get_current_middleware, get_current_mode, get_current_simulation_schema, get_current_simulations, get_logs, get_upstream_proxy, get_usage, get_version, update_destinitation, update_middleware, update_mode, update_simulations
Class Attribute Details
.target ⇒ Object
Returns the value of attribute target.
5
6
7
|
# File 'lib/client.rb', line 5
def target
@target
end
|
Class Method Details
.import(file_list, meta = {}) ⇒ Object
34
35
36
|
# File 'lib/client.rb', line 34
def import(file_list, meta = {})
update_simulations(to_simulation(file_list, meta))
end
|
.middleware(middleware_location) ⇒ Object
30
31
32
|
# File 'lib/client.rb', line 30
def middleware(middleware_location)
update_middleware({ binary: '', script: '', remote: '' }.merge(middleware_location))
end
|
.start(target, mode = 'webserver', **ports) ⇒ Object
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/client.rb', line 7
def start(target, mode = 'webserver', **ports)
@target = target
admin_port = ports.fetch(:admin, 8888)
proxy_port = ports.fetch(:proxy, 8500)
puts "Starting target #{target} with admin #{admin_port} and proxy #{proxy_port}"
system "hoverctl targets create #{@target}"
if mode == 'proxy'
system "hoverctl start --admin-port #{admin_port} --proxy-port #{proxy_port} -t #{@target}"
else
system "hoverctl start webserver --admin-port #{admin_port} --proxy-port #{proxy_port} -t #{@target}"
puts "Unknown Hoverfly mode \"#{mode}\". Starting in webserver mode" if mode != 'webserver'
end
HoverflyAPI.default_options.update(verify: false)
HoverflyAPI.format :json
HoverflyAPI.base_uri "http://localhost:#{admin_port}"
end
|
.stop ⇒ Object
24
25
26
27
28
|
# File 'lib/client.rb', line 24
def stop
puts "Stopping target #{Hoverfly.target} with base URL #{HoverflyAPI.base_uri}"
system "hoverctl stop -t #{@target}"
system "hoverctl targets delete #{@target} -f"
end
|