lib/liberty_buildpack/util/heroku.rb
def generate_vcap_services(env)
      vcap_services = {}
      service_name_map = parse_service_name_map(env)
      env.each do |key, value|
        next unless key.end_with?(URL_SUFFIX, URI_SUFFIX)
        if key.start_with?(POSTGRESQL_PREFIX)
          type, service = handle_postgresql(key, value, service_name_map)
        elsif key.start_with?(CLEARDB_PREFIX)
          type, service = handle_cleardb(key, value, service_name_map)
        elsif key.start_with?(MONGOLAB_PREFIX)
          type, service = handle_mongodb(key, value, service_name_map, 'mongolab')
        elsif key.start_with?(MONGOHQ_PREFIX)
          type, service = handle_mongodb(key, value, service_name_map, 'mongohq')
        elsif key.start_with?(MONGOSOUP_PREFIX)
          type, service = handle_mongodb(key, value, service_name_map, 'mongosoup')
        else
          type = key
          service = {}
          service['name'] = service_name_map[key] || generate_name(key)
          service['credentials'] = create_default_credentials(key, value)
        end

        vcap_services[type] = [service]
      end
      vcap_services
    end
# Generates VCAP_SERVICES style map from a map that represents the environment variables
# as set on Heroku. Each bound service on Heroku sets one or more environment variables that
# specifies the location (in the form of a URL) of the service.
#
# @param [Hash] env - the map with environment variables
# @return [Hash] VCAP_SERVICES style map
Generates VCAP_SERVICES style map from a map that represents the environment variables
as set on Heroku. Each bound service on Heroku sets one or more environment variables that
specifies the location (in the form of a URL) of the service.
Generates VCAP_SERVICES style map from a map that represents the environment variables as set on Heroku . Each bound service on Heroku sets one or more environment variables that specifies the location ( in the form of a URL ) of the service .
def generate_vcap_services(env)
      vcap_services = {}
      service_name_map = parse_service_name_map(env)
      env.each do |key, value|
        next unless key.end_with?(URL_SUFFIX, URI_SUFFIX)
        if key.start_with?(POSTGRESQL_PREFIX)
          type, service = handle_postgresql(key, value, service_name_map)
        elsif key.start_with?(CLEARDB_PREFIX)
          type, service = handle_cleardb(key, value, service_name_map)
        elsif key.start_with?(MONGOLAB_PREFIX)
          type, service = handle_mongodb(key, value, service_name_map, 'mongolab')
        elsif key.start_with?(MONGOHQ_PREFIX)
          type, service = handle_mongodb(key, value, service_name_map, 'mongohq')
        elsif key.start_with?(MONGOSOUP_PREFIX)
          type, service = handle_mongodb(key, value, service_name_map, 'mongosoup')
        else
          type = key
          service = {}
          service['name'] = service_name_map[key] || generate_name(key)
          service['credentials'] = create_default_credentials(key, value)
        end
        vcap_services[type] = [service]
      end
      vcap_services
    end
def generate_vcap_services ( env ) vcap_services = { } service_name_map = parse_service_name_map ( env ) env . each do | key , value | next unless key . end_with? ( URL_SUFFIX , URI_SUFFIX ) if key . start_with? ( POSTGRESQL_PREFIX ) type , service = handle_postgresql ( key , value , service_name_map ) elsif key . start_with? ( CLEARDB_PREFIX ) type , service = handle_cleardb ( key , value , service_name_map ) elsif key . start_with? ( MONGOLAB_PREFIX ) type , service = handle_mongodb ( key , value , service_name_map , 'mongolab' ) elsif key . start_with? ( MONGOHQ_PREFIX ) type , service = handle_mongodb ( key , value , service_name_map , 'mongohq' ) elsif key . start_with? ( MONGOSOUP_PREFIX ) type , service = handle_mongodb ( key , value , service_name_map , 'mongosoup' ) else type = key service = { } service [ 'name' ] = service_name_map [ key ] || generate_name ( key ) service [ 'credentials' ] = create_default_credentials ( key , value ) end vcap_services [ type ] = [ service ] end vcap_services end
Generates VCAP_SERVICES style map from a map that represents the environment variables
as set on Heroku.
Generates VCAP_SERVICES style map from a map that represents the environment variables as set on Heroku .
VCAP_SERVICES style map
VCAP_SERVICES style map
Hash
env
the map with environment variables
the map with environment variables