Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added PGPASSWORD environment variable to Postgres restore command. #2741

Closed
wants to merge 1 commit into from

Conversation

spleenboy
Copy link

Using the Postgres driver, attempt to restore using Craft::$app->getDb()->restore($backupPath) fails with the following error. This pull request adds the password to the environment using the same method as the getDefaultBackupCommand method.

craft\errors\ShellCommandException: The shell command "psql --dbname=craft --host=postgres --port=5432 --username=craft_user --no-password < "storage/backups/backup.sql"" failed with exit code 2: psql: fe_sendauth: no password supplied in /usr/share/nginx/craft/vendor/craftcms/cms/src/errors/ShellCommandException.php:47
Stack trace:
#0 /usr/share/nginx/craft/vendor/craftcms/cms/src/db/Connection.php(561): craft\errors\ShellCommandException::createFromCommand(Object(mikehaertl\shellcommand\Command))
#1 /usr/share/nginx/craft/vendor/craftcms/cms/src/db/Connection.php(308): craft\db\Connection->_executeDatabaseShellCommand(Object(mikehaertl\shellcommand\Command)
...

@brandonkelly
Copy link
Member

Thanks for pointing that out, and the PR! Went about the fix slightly differently, so just committed it myself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants