From 1f950d679344b86d47d0291deafa869e45aa8fbe Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Sat, 23 Aug 2025 21:21:48 -0400 Subject: [PATCH] Env Test --- .env | 2 ++ .env.live | 1 + app/Config/Routes.php | 1 + app/Controllers/Home.php | 8 +++++++- 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.env b/.env index 1d173ef..875ceb1 100644 --- a/.env +++ b/.env @@ -1,3 +1,4 @@ +CONFIG_NAME='This is development'; CONTAINER_PORT=8094 UID=1000 @@ -11,6 +12,7 @@ REMOTE_COMPOSER_PATH = 'chiefsoft@10.10.10.13:/home/chiefsoft/DevSites/MERMS/ DESTINATION_HOME_FOLDER = '/home/chiefsoft/SITES/' ANSIBLE_AUTOMATION_SERVER_LOCATION="http://172.16.4.90:3000" +ANSIBLE_AUTOMATION_PROJECT_ID="8" SOCKET_SERVER_LOCATION="http://10.10.10.13:5006" diff --git a/.env.live b/.env.live index f515d60..1c5e89e 100644 --- a/.env.live +++ b/.env.live @@ -1,3 +1,4 @@ +CONFIG_NAME='This is live'; CONTAINER_PORT=8094 UID=1000 diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 17d100e..7225ecf 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -6,6 +6,7 @@ use CodeIgniter\Router\RouteCollection; * @var RouteCollection $routes */ $routes->get('/', 'Home::index'); +$routes->get('/test', 'Home::what_env'); $routes->get('/provision/prepare', 'Provision::prepareProvision'); $routes->get('/provision/update', 'Provision::updateProvision'); diff --git a/app/Controllers/Home.php b/app/Controllers/Home.php index 4606583..7cc3f29 100644 --- a/app/Controllers/Home.php +++ b/app/Controllers/Home.php @@ -9,6 +9,12 @@ class Home extends BaseController return view('welcome_message'); } + public function what_env(): string + { + $curr_env = $_ENV['CONFIG_NAME']; + echo $curr_env; + return $curr_env; + } public function provision(): string { $public_path = FCPATH; @@ -52,7 +58,7 @@ class Home extends BaseController $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("PROVISION_UID", $provisionUID, $composer_template_contents); + $composer_template_contents = str_replace("PROVISION_UID_REPLACE", $provisionUID, $composer_template_contents); //Save to the specific path $destination_composer_path = $ansible_folder."/parts/".$provisionUID."/docker-compose.yml"; $composerFile = fopen( $destination_composer_path, "w") or die("Unable to open file!");