diff --git a/lib/export/exporter.rb b/lib/export/exporter.rb index e56d93564e1..8cf0e92e318 100644 --- a/lib/export/exporter.rb +++ b/lib/export/exporter.rb @@ -155,7 +155,7 @@ module Export db_conf = Rails.configuration.database_configuration[Rails.env] host = db_conf["host"] password = db_conf["password"] - username = db_conf["username"] || "postgres" + username = db_conf["username"] || ENV["USER"] || "postgres" database = db_conf["database"] password_argument = "PGPASSWORD=#{password}" if password.present? diff --git a/lib/import/importer.rb b/lib/import/importer.rb index 7e78d23eb08..34fc5ecee28 100644 --- a/lib/import/importer.rb +++ b/lib/import/importer.rb @@ -203,7 +203,7 @@ module Import db_conf = Rails.configuration.database_configuration[Rails.env] host = db_conf["host"] password = db_conf["password"] - username = db_conf["username"] || "postgres" + username = db_conf["username"] || ENV["USER"] || "postgres" database = db_conf["database"] password_argument = "PGPASSWORD=#{password}" if password.present?