mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
Use config/database.yml for ClearDB config
If we use .env heroku neither sees DATABASE_URL nor config/database.yml and assumes we use postgre. There also is no need to load the rails env in the task.
This commit is contained in:
parent
70e82632f2
commit
a3dd8e6c95
2 changed files with 5 additions and 6 deletions
|
|
@ -1,11 +1,8 @@
|
|||
namespace :db do
|
||||
desc 'setup DATABASE_URL from CLEARDB_DATABASE_URL in .env'
|
||||
task cleardb_env: :environment do
|
||||
desc 'setup DATABASE_URL from CLEARDB_DATABASE_URL in config/database.yml'
|
||||
task 'cleardb_env' do
|
||||
unless ENV['CLEARDB_DATABASE_URL'].nil?
|
||||
cleardb_url = ENV['CLEARDB_DATABASE_URL'].gsub(/^mysql:\/\//, 'mysql2://')
|
||||
dot_env = File.open(Rails.root.join(".env"), 'w')
|
||||
dot_env.puts "DATABASE_URL=\"#{cleardb_url}\""
|
||||
dot_env.close
|
||||
FileUtils.copy_file('config/database.yml.heroku', 'config/database.yml')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue