Skip to content

Commit

Permalink
Allow custom JDBC urls
Browse files Browse the repository at this point in the history
mitigates #14323
  • Loading branch information
schneems committed Mar 14, 2014
1 parent eaa19cc commit 7f17019
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Expand Up @@ -237,8 +237,8 @@ def resolve_env_connection(spec)
# hash and merges with the rest of the hash.
# Connection details inside of the "url" key win any merge conflicts
def resolve_hash_connection(spec)
if url = spec.delete("url")
connection_hash = resolve_string_connection(url)
if spec["url"] && spec["url"] !~ /^jdbc:/
connection_hash = resolve_string_connection(spec.delete("url"))
spec.merge!(connection_hash)
end
spec
Expand Down
Expand Up @@ -17,6 +17,12 @@ def teardown
ENV["DATABASE_URL"] = @previous_database_url
end

def test_jdbc_url
config = { "production" => { "url" => "jdbc:postgres://localhost/foo" } }
actual = klass.new(config).resolve
assert_equal config, actual
end

def test_environment_does_not_exist_in_config_url_does_exist
ENV['DATABASE_URL'] = "postgres://localhost/foo"
config = { "not_production" => { "adapter" => "not_postgres", "database" => "not_foo" } }
Expand Down

0 comments on commit 7f17019

Please sign in to comment.