Skip to content

Commit

Permalink
Use DATABASE_URL by default
Browse files Browse the repository at this point in the history
See rails#13463 (comment) for full conversation.
  • Loading branch information
schneems committed Jan 2, 2014
1 parent 96288e8 commit f642b18
Show file tree
Hide file tree
Showing 12 changed files with 12 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ test:
# Do not keep production credentials in the repository,
# instead read the configuration from the environment.
production:
url: <%%= ENV["RAILS_DATABASE_URL"] %>
url: <%%= ENV["DATABASE_URL"] %>
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,4 @@ test:
# Do not keep production credentials in the repository,
# instead read the configuration from the environment.
production:
url: <%%= ENV["RAILS_DATABASE_URL"] %>
url: <%%= ENV["DATABASE_URL"] %>
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ test:
# Do not keep production credentials in the repository,
# instead read the configuration from the environment.
production:
url: <%%= ENV["RAILS_DATABASE_URL"] %>
url: <%%= ENV["DATABASE_URL"] %>
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ test:

# Do not keep production credentials in the repository,
# instead read the configuration from the environment.
production: <%%= ENV["RAILS_DATABASE_URL"] %>
production: <%%= ENV["DATABASE_URL"] %>
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ test:
# Do not keep production credentials in the repository,
# instead read the configuration from the environment.
production:
url: <%%= ENV["RAILS_DATABASE_URL"] %>
url: <%%= ENV["DATABASE_URL"] %>
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ test:
# Do not keep production credentials in the repository,
# instead read the configuration from the environment.
production:
url: <%%= ENV["RAILS_DATABASE_URL"] %>
url: <%%= ENV["DATABASE_URL"] %>
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ test:
# mysql2://myuser:mypass@localhost/somedatabase
#
production:
url: <%%= ENV["RAILS_DATABASE_URL"] %>
url: <%%= ENV["DATABASE_URL"] %>
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ test:
# Do not keep production credentials in the repository,
# instead read the configuration from the environment.
production:
url: <%%= ENV["RAILS_DATABASE_URL"] %>
url: <%%= ENV["DATABASE_URL"] %>
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,4 @@ test:
# postgres://myuser:mypass@localhost/somedatabase
#
production:
url: <%%= ENV["RAILS_DATABASE_URL"] %>
url: <%%= ENV["DATABASE_URL"] %>
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ test:
# sqlite3://myuser:mypass@localhost/full/path/to/somedatabase
#
production:
url: <%%= ENV["RAILS_DATABASE_URL"] %>
url: <%%= ENV["DATABASE_URL"] %>
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ test:
# Do not keep production credentials in the repository,
# instead read the configuration from the environment.
production:
url: <%%= ENV["RAILS_DATABASE_URL"] %>
url: <%%= ENV["DATABASE_URL"] %>
9 changes: 1 addition & 8 deletions railties/test/application/rake/dbs_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,9 @@ def database_url_db_name
end

def set_database_url
ENV['RAILS_DATABASE_URL'] = File.join("sqlite3://:@localhost", database_url_db_name)
ENV['DATABASE_URL'] = File.join("sqlite3://:@localhost", database_url_db_name)
# ensure it's using the DATABASE_URL
FileUtils.rm_rf("#{app_path}/config/database.yml")
File.open("#{app_path}/config/database.yml", 'w') do |f|
yaml = <<-YAML.strip_heredoc
#{ENV['RAILS_ENV']}:
url: <%= ENV['RAILS_DATABASE_URL'] %>
YAML
f << yaml
end
end

def expected
Expand Down

0 comments on commit f642b18

Please sign in to comment.