Module: JasonDB

Defined in:
lib/medea/jasondb.rb

Class Method Summary collapse

Class Method Details

.db_auth_url(mode = :secure) ⇒ Object

jason_url here doesn’t include the http:// part, but does include the domain and a trailing ‘/’ ( so it’s “rest.jasondb.com/<domain>/” )



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/medea/jasondb.rb', line 4

def JasonDB::db_auth_url mode=:secure
  config = Rails.configuration.database_configuration[Rails.env]
  
  user = config["user"]
  topic = config["topic"]
  password = config["password"]
  if config["jason_host"]
    host = config["jason_host"]
  else
    host = "rest.jasondb.com"
  end
  protocol = "http"
  protocol << "s" if mode == :secure
  "#{protocol}://#{user}:#{password}@#{host}/#{topic}/"
end