Skip to content

Instantly share code, notes, and snippets.

@trebi
Last active February 14, 2021 12:30
Show Gist options
  • Save trebi/e9140a3d038cfd3d8bc0153de44d13a9 to your computer and use it in GitHub Desktop.
Save trebi/e9140a3d038cfd3d8bc0153de44d13a9 to your computer and use it in GitHub Desktop.
"Switch" valet between multiple users
#!/usr/bin/env bash
valet install
USER=$(whoami)
echo "Updating configuration for user '$USER'"
STR='Users\/[a-zA-Z0-9]*\/'
REPLACE="Users\/$USER\/"
REGEX="s/$STR/$REPLACE/g"
sed -i '' -e $REGEX /usr/local/etc/nginx/valet/valet.conf
sed -i '' -e $REGEX /usr/local/etc/nginx/nginx.conf
find ~/.config/valet/Nginx/*.test -type f -exec sed -i '' -e $REGEX {} \;
echo "Configuration for user '$USER' updated"
valet restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment