service/src/get-port.cr

20 lines
414 B
Crystal
Raw Normal View History

2019-10-25 13:10:20 +02:00
2019-10-20 18:05:31 +02:00
require "./config.cr"
2019-10-29 12:32:49 +01:00
require "./service/environment.cr"
require "./service/service_definition.cr"
require "./service/service.cr"
2019-10-20 18:05:31 +02:00
2019-10-29 12:32:49 +01:00
Environment.load ENVIRONMENTS_DIRECTORY
ServiceDefinition.load SERVICES_DIRECTORY
Service.load RC_DIRECTORY
2019-10-20 18:05:31 +02:00
2019-10-29 12:32:49 +01:00
if ARGV.size != 2
STDERR.puts "usage: get-port <service-id> <port-id>"
exit 1
2019-10-25 13:10:20 +02:00
end
2019-10-20 18:05:31 +02:00
2019-10-29 12:32:49 +01:00
service_id, port_id = ARGV
2019-10-20 18:05:31 +02:00
2019-10-29 12:32:49 +01:00
puts Service.get_by_id(service_id).not_nil!.ports[port_id]
2019-10-20 18:05:31 +02:00