diff --git a/configs/fox-api/example.env b/configs/fox-api/example.env new file mode 100644 index 0000000..c86de38 --- /dev/null +++ b/configs/fox-api/example.env @@ -0,0 +1,79 @@ +#FOX API NodeJS Coder Env +#This file is used to configure the environment for the API +#NOT FOR PRODUCTION USE + +#Configuration built +#CONFIGURATION_BUILD_DATE + +#Feel free to edit these values with your own + +#Paseto Config (Deprecated) +PASETO_PUBLIC_KEY=DONT_USE +PASETO_SECRET_KEY=DONT_USE + +#Discord Functionality Enabled +DEV_DISCORD_DISABLE=1 + +#Discord Configuration +DISCORD_BASE_URL=https://discord.com/api/v10 +DISCORD_BOT_TOKEN=CHANGE_ME_I_DONT_WORK + +#Discord Roles +DISCORD_ATTENDEE_ROLE=xxxx +DISCORD_BUDDY_ROLE=xxxx +DISCORD_FIRST_CLASS_ROLE=xxxx +DISCORD_SPONSOR_ROLE=xxxx + +#Discord Guild Information +DISCORD_GUILD_ID=xxxx +DISCORD_REGISTRATION_LOG_CHANNEL=xxxx + + + +#========================================= +#= !!! DO NOT EDIT BELOW !!! = +#= These are set by the bootstrap script = +#========================================= + +#General Configuration +BASE_URL= +CONVENTION_ID=DEV0 +VERSION=dev-env-0.0.0 + +#Redis Configuration +REDIS_HOST= +REDIS_PORT= +REDIS_PASSWORD= + +#Database Configuration +DATABASE_HOST= +DATABASE_PORT= +DATABASE_USER= +DATABASE_PASSWORD= +DATABASE_NAME= +DATABASE_LOGGING=true + +#OIDC Configuration +OIDC_BASE_URL= +OIDC_CLIENT_ID= +OIDC_CLIENT_SECRET= + +#Postmark Configuration +POSTMARK_API_KEY=EMAIL_SENDING_IS_DISABLED + +#Shopify Configuration (Disabled due to dev enviorment) +SHOPIFY_DEV_DISABLE=1 + +SHOPIFY_BASE_URL=https://furality.myshopify.com/admin/api/2022-04 +SHOPIFY_API_KEY=I_DONT_WORK +SHOPIFY_PASSWORD=I_DONT_WORK +SHOPIFY_FIRST_CLASS_DISCOUNT=I_DONT_WORK +SHOPIFY_SPONSOR_DISCOUNT=I_DONT_WORK + +#VRChat Configuration (Disabled due to dev enviorment) +VRCHAT_DEV_DISABLE=1 + +VRCHAT_USERNAME=CHANGE_ME_I_DONT_WORK +VRCHAT_PASSWORD=CHANGE_ME_I_DONT_WORK + +#END OF FILE \ No newline at end of file diff --git a/scripts/fox-api/bootstrap-node.sh b/scripts/fox-api/bootstrap-node.sh index e69de29..cda2887 100644 --- a/scripts/fox-api/bootstrap-node.sh +++ b/scripts/fox-api/bootstrap-node.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +echo "[BOOTSTRAP] Running initial setup for F.O.X. API (Node)..." + + +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/.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/.dbpass + +echo "[BOOTSTRAP] DB Configured, setting up .env file..." + +# read /home/coder/.coder-env as they contain the workspace name and username + +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) + +sed -i "s/DATABASE_HOST=10.10.30.11/DATABASE_HOST=localhost/g" /home/coder/fox-api/.env +sed -i "s/DATABASE_PORT=3306/DATABASE_PORT=3306/g" /home/coder/fox-api/.env +sed -i "s/DATABASE_USER=/DATABASE_USER=fox_api/g" /home/coder/fox-api/.env +sed -i "s/DATABASE_PASSWORD=/DATABASE_PASSWORD=$password/g" /home/coder/fox-api/.env +sed -i "s/DATABASE_NAME=/DATABASE_NAME=fox_api/g" /home/coder/fox-api/.env + +sed -i "s/REDIS_HOST=127.0.0.1/REDIS_HOST=localhost/g" /home/coder/fox-api/.env +sed -i \ No newline at end of file