Class: CFRuntime::MysqlParser

Inherits:
Object
  • Object
show all
Defined in:
lib/cf-runtime/parser/mysql_parser.rb

Class Method Summary collapse

Class Method Details

.parse(svc) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/cf-runtime/parser/mysql_parser.rb', line 3

def self.parse(svc)
  serviceopts = {}
  { :username => :username,
    :password => :password,
    :hostname => :host,
    :port => :port,
    :name => :database
  }.each do |from, to|
    serviceopts[to] = svc["credentials"][from.to_s]
  end
  serviceopts[:url] = svc["credentials"]["url"] ||
    "mysql://#{serviceopts[:username]}:#{serviceopts[:password]}@" +
    "#{serviceopts[:host]}:#{serviceopts[:port]}/#{serviceopts[:database]}"
  serviceopts
end