diff --git a/db-start/composer.json b/db-test/composer.json similarity index 100% rename from db-start/composer.json rename to db-test/composer.json diff --git a/db-start/css/.gitkeep b/db-test/css/.gitkeep similarity index 100% rename from db-start/css/.gitkeep rename to db-test/css/.gitkeep diff --git a/db-start/css/styles.css b/db-test/css/styles.css similarity index 100% rename from db-start/css/styles.css rename to db-test/css/styles.css diff --git a/db-start/img/.gitkeep b/db-test/img/.gitkeep similarity index 100% rename from db-start/img/.gitkeep rename to db-test/img/.gitkeep diff --git a/db-start/includes/.gitkeep b/db-test/includes/.gitkeep similarity index 100% rename from db-start/includes/.gitkeep rename to db-test/includes/.gitkeep diff --git a/db-start/index.php b/db-test/index.php similarity index 59% rename from db-start/index.php rename to db-test/index.php index 66710a2..3b51870 100644 --- a/db-start/index.php +++ b/db-test/index.php @@ -4,12 +4,20 @@ require_once 'vendor/autoload.php'; $dotenv = Dotenv\Dotenv::createImmutable(__DIR__); $dotenv->safeLoad(); $db_pass = $_ENV['DATABASE_PASSWORD']; +$ip_addr = $_ENV['IP_ADDRESS']; // Make some constants -define('HOST', '173.255.248.228'); -define('USER', 'root'); -define('PASS', $db_pass); -define('DB', 'palindromes'); +if ($_SERVER['HTTP_HOST'] == 'localhost') { + define('HOST', 'localhost'); + define('USER', 'root'); + define('PASS', $db_pass); + define('DB', 'palindromes'); +} else { + define('HOST', $ip_addr); + define('USER', 'root'); + define('PASS', $db_pass); + define('DB', 'palindromes'); +} // Connect to the DB $conn = mysqli_connect(HOST, USER, PASS, DB); diff --git a/db-start/js/.gitkeep b/db-test/js/.gitkeep similarity index 100% rename from db-start/js/.gitkeep rename to db-test/js/.gitkeep diff --git a/db-start/js/index.js b/db-test/js/index.js similarity index 100% rename from db-start/js/index.js rename to db-test/js/index.js diff --git a/db-start/pal.sql b/db-test/pal.sql similarity index 100% rename from db-start/pal.sql rename to db-test/pal.sql