Auto-generate dev-secrets file.

Source LOCAL_DATABASE_PASSWORD and INITIAL_PASSWORD_SALT from the secrets file.
Fix the creation of pgpass file.

Tim's note: This will definitely break the original purpose of the
tool but it should be pretty easy to add that back as an option.

(imported from commit 8ab31ea2b7cbc80a4ad2e843a2529313fad8f5cf)
This commit is contained in:
Cat Miller
2015-08-19 23:15:21 -07:00
committed by Tim Abbott
parent 86278804c9
commit 0a20f168a7
6 changed files with 41 additions and 46 deletions

View File

@@ -48,9 +48,12 @@ ALTER ROLE $VAGRANTUSERNAME SET search_path TO $SEARCH_PATH;
EOF
umask go-rw
PGPASS_LINE="*:*:*:$USERNAME:$PASSWORD"
if ! $(grep -q "$PGPASS_LINE" ~/.pgpass); then
echo $PGPASS_LINE >> ~/.pgpass
PGPASS_PREFIX="*:*:*:$USERNAME:"
PGPASS_ESCAPED_PREFIX="*:\*:\*:$USERNAME:"
if ! $(grep -q "$PGPASS_ESCAPED_PREFIX" ~/.pgpass); then
echo $PGPASS_PREFIX$PASSWORD >> ~/.pgpass
else
sed -i 's/$PGPASS_ESCAPED_PREFIX.*$/$PGPASS_PREFIX$PASSWORD/' ~/.pgpass
fi
chmod go-rw ~/.pgpass