Sha256: e70e67a5f6e6766fd26a093162e0d590e9382e3e9610eb8eb4ef3c87012b90e4
Contents?: true
Size: 1000 Bytes
Versions: 117
Compression:
Stored size: 1000 Bytes
Contents
#!/usr/bin/env ruby # Copyright (c) 2009-2011 VMware, Inc. $:.unshift(File.dirname(__FILE__) + '/lib') require 'rubygems' require 'bundler/setup' require 'caldecott' require 'sinatra' require 'json' require 'eventmachine' port = ENV['PORT'] port ||= 8081 # add vcap specific stuff to Caldecott class VcapHttpTunnel < Caldecott::Server::HttpTunnel get '/info' do { "version" => '0.0.4' }.to_json end def self.get_tunnels super end get '/services' do services_env = ENV['VCAP_SERVICES'] return "no services env" if services_env.nil? or services_env.empty? services_env end get '/services/:service' do |service_name| services_env = ENV['VCAP_SERVICES'] not_found if services_env.nil? services = JSON.parse(services_env).values.flatten(1) service = services.find { |s| s["name"] == service_name } not_found if service.nil? service["credentials"].to_json end end VcapHttpTunnel.run!(:port => port, :auth_token => ENV["CALDECOTT_AUTH"])
Version data entries
117 entries across 117 versions & 4 rubygems