Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
connect to Moodle Support Database in Google Cloud
#!/usr/bin/env fish
# Requires: gcloud installed, cca-integrations project config added
set PREVIOUS_PROJECT (gcloud config get-value project 2>/dev/null)
echo "Changing gcloud project from $PREVIOUS_PROJECT to cca-integrations"
gcloud config set project cca-integrations >/dev/null
# NOTE: you'll want to have this secret in your env or hardcoded here
echo $MDL_SUPPORT_DB_PW | pbcopy
set_color --bold
and echo 'The moodle_user password is on your clipboard; paste it at the prompt.'
set_color normal
gcloud sql connect int-instance --user=moodle_user --database=moodle_support_db
and gcloud config set project $PREVIOUS_PROJECT >/dev/null
and echo "Reset the active gcloud project back to $PREVIOUS_PROJECT"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment