service/src/get-port.cr

20 lines
414 B
Crystal

require "./config.cr"
require "./service/environment.cr"
require "./service/service_definition.cr"
require "./service/service.cr"
Environment.load ENVIRONMENTS_DIRECTORY
ServiceDefinition.load SERVICES_DIRECTORY
Service.load RC_DIRECTORY
if ARGV.size != 2
STDERR.puts "usage: get-port <service-id> <port-id>"
exit 1
end
service_id, port_id = ARGV
puts Service.get_by_id(service_id).not_nil!.ports[port_id]