From fbb3dc6a676abb8bc2c82d4eb9336512c3da2f6b Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Mon, 15 Sep 2025 12:23:21 -0400 Subject: [PATCH] Fix config --- .env | 4 +++- .env.live | 3 ++- app/Controllers/Provision.php | 27 +++++++++++++++++---------- 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/.env b/.env index 7e0076d..e5857ab 100644 --- a/.env +++ b/.env @@ -1,4 +1,4 @@ -CONFIG_NAME='This is NOT development. It is not how envrionment works in CodeIgniter!' +CONFIG_NAME='This is NOT development. It is not how environment works in CodeIgniter!' CONTAINER_PORT=8094 UID=1000 @@ -37,6 +37,8 @@ PROVISION_MSQL_DATABASE_PASSWORD="may12002!" PROVISION_MSQL_DATABASE="wordpress" PROVISION_MSQL_DATABASE_PORT="3307" +SITE_CONTENTS_GATEWAY="http://10.10.10.101:14700/web/contents" +SITE_CONTACT_GATEWAY="http://10.10.10.101:14700/web/contacts" #-------------------------------------------------------------------- diff --git a/.env.live b/.env.live index 587e8f1..3e601e0 100644 --- a/.env.live +++ b/.env.live @@ -37,7 +37,8 @@ PROVISION_MSQL_DATABASE_PASSWORD="may12002!" PROVISION_MSQL_DATABASE="wordpress" PROVISION_MSQL_DATABASE_PORT="3307" - +SITE_CONTENTS_GATEWAY="http://10.10.11.41:14700/web/contents" +SITE_CONTACT_GATEWAY="http://10.10.11.41:14700/web/contacts" #-------------------------------------------------------------------- # Example Environment Configuration file diff --git a/app/Controllers/Provision.php b/app/Controllers/Provision.php index 4fc12b1..1a61c8c 100644 --- a/app/Controllers/Provision.php +++ b/app/Controllers/Provision.php @@ -5,7 +5,8 @@ namespace App\Controllers; class Provision extends BaseController { - private function testSocket(): void{ + private function testSocket(): void + { // TELL THE SOCKET TO REFRESH PAGE $data["product_uid"] = "bea86662-adb3-4c09-816b-014f450d9713"; $data["provision_action"] = "Auto%20Configuration%20Started"; @@ -19,7 +20,7 @@ class Provision extends BaseController //$this->testSocket(); $current_database = $_ENV['MAIN_DATABASE_IP']; - log_message('critical', "***** ***** prepareProvision :: Working Database ".$current_database ); + log_message('critical', "***** ***** prepareProvision :: Working Database " . $current_database); log_message('critical', "***** ***** prepareProvision :: Starting Port Allocation "); $this->allocatePortNo(); // allocte port for the conyainer use @@ -173,16 +174,19 @@ class Provision extends BaseController // Do the processing $composer_template_contents = str_replace("WHAT_CONTAINER_NAME", $ContainerName, $composer_template_contents); //$destinationHomeFolder = "/home/chiefsoft/SITES/" . $ContainerName; + $SITE_CONTENTS_GATEWAY = $_ENV['SITE_CONTENTS_GATEWAY']; + $SITE_CONTACT_GATEWAY = $_ENV['SITE_CONTACT_GATEWAY']; + $MYSQL_PROVISION_DATABASE_PORT = $_ENV['PROVISION_MSQL_DATABASE_IP'] . ":" . $_ENV['PROVISION_MSQL_DATABASE_PORT']; // "172.16.4.96:3307"; $destinationHomeFolder = $_ENV['DESTINATION_HOME_FOLDER'] . $ContainerName; $composer_template_contents = str_replace("DESTINATION_FOLDER", $destinationHomeFolder, $composer_template_contents); $composer_template_contents = str_replace("ALLOCATED_PORT", $allocatedPort, $composer_template_contents); $composer_template_contents = str_replace("CNT_DB_NAME", $ContainerName, $composer_template_contents); $composer_template_contents = str_replace("CNT_DB_PASS", $provisionUID, $composer_template_contents); - $composer_template_contents = str_replace("CNT_DB_DATA", '172.16.4.96:3307', $composer_template_contents); + $composer_template_contents = str_replace("CNT_DB_DATA", $MYSQL_PROVISION_DATABASE_PORT, $composer_template_contents); $composer_template_contents = str_replace("PROVISION_UID_REPLACE", $provisionUID, $composer_template_contents); - $composer_template_contents = str_replace("PROVISION_IMAGE_NAME_REPLACE","registry.chiefsoft.com/pweb/pweb-01-merms-pweb0006c:latest", $composer_template_contents); - $composer_template_contents = str_replace("SITE_CONTENTS_URL_REPLACE", "http://10.10.10.101:14700/web/contents", $composer_template_contents); - $composer_template_contents = str_replace("SITE_CONTACT_URL_REPLACE", "http://10.10.10.101:14700/web/contacts", $composer_template_contents); + $composer_template_contents = str_replace("PROVISION_IMAGE_NAME_REPLACE", "registry.chiefsoft.com/pweb/pweb-01-merms-pweb0006c:latest", $composer_template_contents); + $composer_template_contents = str_replace("SITE_CONTENTS_URL_REPLACE", $SITE_CONTENTS_GATEWAY, $composer_template_contents); + $composer_template_contents = str_replace("SITE_CONTACT_URL_REPLACE", $SITE_CONTACT_GATEWAY, $composer_template_contents); $templateRandom = 'P' . rand(1, 6); $composer_template_contents = str_replace("TEMPLATE_NAME_REPLACE", $templateRandom, $composer_template_contents); @@ -375,16 +379,19 @@ class Provision extends BaseController // Do the processing $composer_template_contents = str_replace("WHAT_CONTAINER_NAME", $ContainerName, $composer_template_contents); //$destinationHomeFolder = "/home/chiefsoft/SITES/" . $ContainerName; + $SITE_CONTENTS_GATEWAY = $_ENV['SITE_CONTENTS_GATEWAY']; + $SITE_CONTACT_GATEWAY = $_ENV['SITE_CONTACT_GATEWAY']; + $MYSQL_PROVISION_DATABASE_PORT = $_ENV['PROVISION_MSQL_DATABASE_IP'] . ":" . $_ENV['PROVISION_MSQL_DATABASE_PORT']; // "172.16.4.96:3307"; $destinationHomeFolder = $_ENV['DESTINATION_HOME_FOLDER'] . $ContainerName; $composer_template_contents = str_replace("DESTINATION_FOLDER", $destinationHomeFolder, $composer_template_contents); $composer_template_contents = str_replace("ALLOCATED_PORT", $allocatedPort, $composer_template_contents); $composer_template_contents = str_replace("CNT_DB_NAME", $ContainerName, $composer_template_contents); $composer_template_contents = str_replace("CNT_DB_PASS", $provisionUID, $composer_template_contents); - $composer_template_contents = str_replace("CNT_DB_DATA", '172.16.4.96:3307', $composer_template_contents); + $composer_template_contents = str_replace("CNT_DB_DATA", $MYSQL_PROVISION_DATABASE_PORT, $composer_template_contents); $composer_template_contents = str_replace("PROVISION_UID_REPLACE", $provisionUID, $composer_template_contents); - $composer_template_contents = str_replace("PROVISION_IMAGE_NAME_REPLACE","registry.chiefsoft.com/pweb/pweb-01-merms-pweb0006c:latest", $composer_template_contents); - $composer_template_contents = str_replace("SITE_CONTENTS_URL_REPLACE", "http://10.10.10.101:14700/web/contents", $composer_template_contents); - $composer_template_contents = str_replace("SITE_CONTACT_URL_REPLACE", "http://10.10.10.101:14700/web/contacts", $composer_template_contents); + $composer_template_contents = str_replace("PROVISION_IMAGE_NAME_REPLACE", "registry.chiefsoft.com/pweb/pweb-01-merms-pweb0006c:latest", $composer_template_contents); + $composer_template_contents = str_replace("SITE_CONTENTS_URL_REPLACE", $SITE_CONTENTS_GATEWAY, $composer_template_contents); + $composer_template_contents = str_replace("SITE_CONTACT_URL_REPLACE", $SITE_CONTACT_GATEWAY, $composer_template_contents); $templateRandom = 'P' . rand(1, 6);