提交 5aa86986 编写于 作者: R Rafael Mendonça França

Merge pull request #13578 from schneems/schneems/database_url-env-default

Use DATABASE_URL by default
......@@ -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"] %>
......@@ -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"] %>
......@@ -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"] %>
......@@ -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"] %>
......@@ -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"] %>
......@@ -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"] %>
......@@ -39,4 +39,4 @@ test:
# mysql2://myuser:mypass@localhost/somedatabase
#
production:
url: <%%= ENV["RAILS_DATABASE_URL"] %>
url: <%%= ENV["DATABASE_URL"] %>
......@@ -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"] %>
......@@ -66,4 +66,4 @@ test:
# postgres://myuser:mypass@localhost/somedatabase
#
production:
url: <%%= ENV["RAILS_DATABASE_URL"] %>
url: <%%= ENV["DATABASE_URL"] %>
......@@ -27,4 +27,4 @@ test:
# sqlite3://myuser:mypass@localhost/full/path/to/somedatabase
#
production:
url: <%%= ENV["RAILS_DATABASE_URL"] %>
url: <%%= ENV["DATABASE_URL"] %>
......@@ -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"] %>
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册