From cd34f0db5c71dadebf251a9242865ecc7c698d45 Mon Sep 17 00:00:00 2001 From: Ratstail91 Date: Fri, 3 May 2024 09:22:45 +1000 Subject: [PATCH] Fully tested the remote database Added default host for the admin account --- README.md | 4 ++-- configure-script.js | 4 ++++ tools/create_database.sql | 13 ++++--------- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index abafd13..601422e 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ The primary technology involved is: * React * Nodejs * MariaDB (with Sequelize) -* Docker (with docker-compose) +* Docker (with docker compose) This template is designed to support the development of persistent browser based games (PBBGs), but it, and it's component microservices, can be used elsewhere. @@ -31,7 +31,7 @@ A clean install is this easy: git clone https://github.com/krgamestudios/MERN-template.git cd MERN-template node configure-script.js -docker-compose up --build +docker compose up --build ``` # Setup Development diff --git a/configure-script.js b/configure-script.js index 34e3b57..b323034 100644 --- a/configure-script.js +++ b/configure-script.js @@ -170,11 +170,14 @@ See https://github.com/krgamestudios/MERN-template/wiki for help. //MUST be at least 8 chars let tmpPass = ''; + let tmpHost = ''; while (defaultUser && tmpPass.length < 8) { console.log('--All passwords must be at least 8 characters long--'); tmpPass = await question('Default Admin Pass', ''); + tmpHost = await question('Default Admin Host', ''); } const defaultPass = tmpPass; + const defaultHost = tmpHost; if (defaultUser) { console.log(`Default user email will be: ${defaultUser}@${authWebAddress}`); @@ -281,6 +284,7 @@ services: - MAIL_PASSWORD=${emailPass} - MAIL_PHYSICAL=${emailPhysical} - ADMIN_DEFAULT_USERNAME=${defaultUser} + - ADMIN_DEFAULT_HOSTNAME=${defaultHost} - ADMIN_DEFAULT_PASSWORD=${defaultPass} - SECRET_ACCESS=${accessToken} - SECRET_REFRESH=${refreshToken} diff --git a/tools/create_database.sql b/tools/create_database.sql index d064325..66b7235 100644 --- a/tools/create_database.sql +++ b/tools/create_database.sql @@ -1,10 +1,5 @@ -#This file only needs to be run once, during initial development setup -#This file isnt needed for actual deployment +#use this while debugging +CREATE DATABASE template; +CREATE USER 'template'@'%' IDENTIFIED BY 'pikachu'; +GRANT ALL PRIVILEGES ON template.* TO 'template'@'%'; -#Create the development database -CREATE DATABASE IF NOT EXISTS template; -USE template; - -#Create the database user -CREATE USER IF NOT EXISTS 'template'@'%' IDENTIFIED BY 'pikachu'; -GRANT ALL PRIVILEGES ON template.* TO 'template'@'%'; \ No newline at end of file