mirror of
https://github.com/discourse/discourse.git
synced 2025-05-30 15:28:37 +08:00
BUGFIX: backup/restore rake tasks weren't working
This commit is contained in:
@ -152,14 +152,10 @@ module Export
|
||||
end
|
||||
|
||||
def build_pg_dump_command
|
||||
db_conf = Rails.configuration.database_configuration[Rails.env]
|
||||
host = db_conf["host"]
|
||||
password = db_conf["password"]
|
||||
username = db_conf["username"] || ENV["USER"] || "postgres"
|
||||
database = db_conf["database"]
|
||||
db_conf = BackupRestore.database_configuration
|
||||
|
||||
password_argument = "PGPASSWORD=#{password}" if password.present?
|
||||
host_argument = "--host=#{host}" if host.present?
|
||||
password_argument = "PGPASSWORD=#{password}" if db_conf.password.present?
|
||||
host_argument = "--host=#{host}" if db_conf.host.present?
|
||||
|
||||
[ password_argument, # pass the password to pg_dump
|
||||
"pg_dump", # the pg_dump command
|
||||
@ -169,8 +165,8 @@ module Export
|
||||
"--no-privileges", # prevent dumping of access privileges
|
||||
"--verbose", # specifies verbose mode
|
||||
host_argument, # the hostname to connect to
|
||||
"--username=#{username}", # the username to connect as
|
||||
database # the name of the database to dump
|
||||
"--username=#{db_conf.username}", # the username to connect as
|
||||
db_conf.database # the name of the database to dump
|
||||
].join(" ")
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user