#!/bin/bash echo "[BOOTSTRAP] Running initial setup for PHP F.O.X. API ..." mysql -u root -e "CREATE DATABASE IF NOT EXISTS fox_api;" password=$(openssl rand -base64 32) password=$(echo $password | sed 's/[^a-zA-Z0-9]//g') echo $password > /home/coder/fox-api/.dbpass mysqladmin -u root password $password 2>&1 | grep -v "Warning" mysql -u root -p$password -e "CREATE USER 'fox_api'@'%' IDENTIFIED BY '$password';" 2>&1 | grep -v "Warning" mysql -u root -p$password -e "GRANT ALL PRIVILEGES ON fox_api.* TO 'fox_api'@'%';" 2>&1 | grep -v "Warning" mysql -u root -p$password -e "FLUSH PRIVILEGES;" 2>&1 | grep -v "Warning" chown coder:coder /home/coder/fox-api/.dbpass echo "[BOOTSTRAP] DB Configured, setting up .env file..." # read /home/coder/.coder-env as they contain the workspace name and username