Update boop-keys/setup-boop.sh

This commit is contained in:
Kakious 2023-07-21 13:32:43 -07:00
parent 8982fa741a
commit 1618243ac8

View file

@ -4,6 +4,7 @@ echo "[BOOTSTRAP] Running initial setup for BOOP..."
mysql -u root -e "CREATE DATABASE IF NOT EXISTS oauth_provider;" mysql -u root -e "CREATE DATABASE IF NOT EXISTS oauth_provider;"
password=$(openssl rand -base64 32) password=$(openssl rand -base64 32)
password=$(echo $password | sed 's/[^a-zA-Z0-9]//g')
echo $password > /home/coder/oauth-provider/.dbpass echo $password > /home/coder/oauth-provider/.dbpass
mysqladmin -u root password $password mysqladmin -u root password $password
mysql -u root -p$password -e "CREATE USER 'oauth_provider'@'%' IDENTIFIED BY '$password';" mysql -u root -p$password -e "CREATE USER 'oauth_provider'@'%' IDENTIFIED BY '$password';"
@ -17,8 +18,17 @@ echo "[BOOTSTRAP] DB Configured, setting up .env file..."
echo "[BOOTSTRAP] Generating Encryption Secret" echo "[BOOTSTRAP] Generating Encryption Secret"
# generate encryption secret encryption_secret=$(openssl rand -base64 64)
encryption_secret=$(openssl rand -base64 32) encryption_secret=$(echo $encryption_secret | sed 's/[^a-zA-Z0-9]//g')
while [ ${#encryption_secret} -lt 64 ]
do
encryption_secret_2=$(openssl rand -base64 64)
encryption_secret_2=$(echo $encryption_secret_2 | sed 's/[^a-zA-Z0-9]//g')
encryption_secret=$encryption_secret$encryption_secret_2
done
encryption_secret=${encryption_secret:0:64}
WORKSPACE_ENV=$(cat /home/coder/.coder-env | grep WORKSPACE_ENV | cut -d '=' -f2) WORKSPACE_ENV=$(cat /home/coder/.coder-env | grep WORKSPACE_ENV | cut -d '=' -f2)
USERNAME_ENV=$(cat /home/coder/.coder-env | grep USERNAME_ENV | cut -d '=' -f2) USERNAME_ENV=$(cat /home/coder/.coder-env | grep USERNAME_ENV | cut -d '=' -f2)