Template random
This commit is contained in:
@@ -11,6 +11,7 @@ services:
|
|||||||
- ./apache_log:/var/log/apache2:Z
|
- ./apache_log:/var/log/apache2:Z
|
||||||
environment:
|
environment:
|
||||||
- PROVISION_UID=PROVISION_UID_REPLACE
|
- PROVISION_UID=PROVISION_UID_REPLACE
|
||||||
|
- TEMPLATE_NAME=TEMPLATE_NAME_REPLACE
|
||||||
# - APACHE_RUN_USER=1000
|
# - APACHE_RUN_USER=1000
|
||||||
# - APACHE_RUN_GROUP=1000
|
# - APACHE_RUN_GROUP=1000
|
||||||
networks:
|
networks:
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ services:
|
|||||||
- ./apache_log:/var/log/apache2:Z
|
- ./apache_log:/var/log/apache2:Z
|
||||||
environment:
|
environment:
|
||||||
- PROVISION_UID=PROVISION_UID_REPLACE
|
- PROVISION_UID=PROVISION_UID_REPLACE
|
||||||
|
- TEMPLATE_NAME=TEMPLATE_NAME_REPLACE
|
||||||
# - APACHE_RUN_USER=1000
|
# - APACHE_RUN_USER=1000
|
||||||
# - APACHE_RUN_GROUP=1000
|
# - APACHE_RUN_GROUP=1000
|
||||||
networks:
|
networks:
|
||||||
|
|||||||
@@ -177,6 +177,10 @@ class Provision extends BaseController
|
|||||||
$composer_template_contents = str_replace("CNT_DB_PASS", $provisionUID, $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", '172.16.4.96:3307', $composer_template_contents);
|
||||||
$composer_template_contents = str_replace("PROVISION_UID_REPLACE", $provisionUID, $composer_template_contents);
|
$composer_template_contents = str_replace("PROVISION_UID_REPLACE", $provisionUID, $composer_template_contents);
|
||||||
|
$templateRandom = rand(1,6).'p';
|
||||||
|
$composer_template_contents = str_replace("TEMPLATE_NAME_REPLACE", $templateRandom, $composer_template_contents);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//Save to the specific path
|
//Save to the specific path
|
||||||
$destination_composer_path = $ansible_folder . "/parts/" . $provisionUID . "/docker-compose.yml";
|
$destination_composer_path = $ansible_folder . "/parts/" . $provisionUID . "/docker-compose.yml";
|
||||||
@@ -371,6 +375,8 @@ class Provision extends BaseController
|
|||||||
$composer_template_contents = str_replace("CNT_DB_PASS", $provisionUID, $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", '172.16.4.96:3307', $composer_template_contents);
|
||||||
$composer_template_contents = str_replace("PROVISION_UID_REPLACE", $provisionUID, $composer_template_contents);
|
$composer_template_contents = str_replace("PROVISION_UID_REPLACE", $provisionUID, $composer_template_contents);
|
||||||
|
$templateRandom = rand(1,6).'p';
|
||||||
|
$composer_template_contents = str_replace("TEMPLATE_NAME_REPLACE", $templateRandom, $composer_template_contents);
|
||||||
//Save to the specific path
|
//Save to the specific path
|
||||||
$composerFile = fopen($destination_composer_path, "w") or die("Unable to open file!");
|
$composerFile = fopen($destination_composer_path, "w") or die("Unable to open file!");
|
||||||
fwrite($composerFile, $composer_template_contents);
|
fwrite($composerFile, $composer_template_contents);
|
||||||
|
|||||||
Reference in New Issue
Block a user