merm compatible

This commit is contained in:
CHIEFSOFT\ameye
2025-10-05 15:46:15 -04:00
parent 03f40bb77f
commit 7dd9e23a04
7 changed files with 169 additions and 86 deletions
+5 -70
View File
@@ -1,71 +1,6 @@
CONTAINER_PORT=62100
APP_PORT=62100
UID=1000
#--------------------------------------------------------------------
# Example Environment Configuration file
#
# This file can be used as a starting point for your own
# custom .env files, and contains most of the possible settings
# available in a default install.
#
# By default, all of the settings are commented out. If you want
# to override the setting, you must un-comment it by removing the '#'
# at the beginning of the line.
#--------------------------------------------------------------------
#--------------------------------------------------------------------
# ENVIRONMENT
#--------------------------------------------------------------------
# CI_ENVIRONMENT = production
#--------------------------------------------------------------------
# APP
#--------------------------------------------------------------------
# app.baseURL = ''
# If you have trouble with `.`, you could also use `_`.
# app_baseURL = ''
# app.forceGlobalSecureRequests = false
# app.CSPEnabled = false
#--------------------------------------------------------------------
# DATABASE
#--------------------------------------------------------------------
# database.default.hostname = localhost
# database.default.database = ci4
# database.default.username = root
# database.default.password = root
# database.default.DBDriver = MySQLi
# database.default.DBPrefix =
# database.default.port = 3306
# If you use MySQLi as tests, first update the values of Config\Database::$tests.
# database.tests.hostname = localhost
# database.tests.database = ci4_test
# database.tests.username = root
# database.tests.password = root
# database.tests.DBDriver = MySQLi
# database.tests.DBPrefix =
# database.tests.charset = utf8mb4
# database.tests.DBCollat = utf8mb4_general_ci
# database.tests.port = 3306
#--------------------------------------------------------------------
# ENCRYPTION
#--------------------------------------------------------------------
# encryption.key =
#--------------------------------------------------------------------
# SESSION
#--------------------------------------------------------------------
# session.driver = 'CodeIgniter\Session\Handlers\FileHandler'
# session.savePath = null
#--------------------------------------------------------------------
# LOGGER
#--------------------------------------------------------------------
# logger.threshold = 4
PROVISION_UID=3cc24fd6-e6c7-4c08-8a64-f06e3f790f38
CONTENTS_SERVER="https://devapi.mermsemr.com/web/contents"
CONTENTS_SERVER2="http://10.10.10.101:14700/web/contents"
SITE_CONTACT_URL="https://devapi.mermsemr.com/web/contacts"
+61
View File
@@ -55,4 +55,65 @@ abstract class BaseController extends Controller
// E.g.: $this->session = \Config\Services::session();
}
public function getenv_docker($env, $default)
{
if ($fileEnv = getenv($env . '_FILE')) {
return rtrim(file_get_contents($fileEnv), "\r\n");
} else if (($val = getenv($env)) !== false) {
return $val;
} else {
return $default;
}
}
public function ExternalAPICall($method, $url, $data)
{
// $curl = curl_init();
$curl = curl_init($url);
switch ($method) {
case "GET":
$params2 = '';
foreach ($data as $key2 => $value2)
$params2 .= $key2 . '=' . $value2 . '&';
$params2 = trim($params2, '&');
$url = $url . '?' . $params2;// add param to URL
log_message('critical', "API URL FINAL =>" . $url);
//curl_setopt($curl, CURLOPT_FRESH_CONNECT, true);
//curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
//curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data));
break;
case "POST":
curl_setopt($curl, CURLOPT_POST, 1);
if ($data)
// curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data));
// curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data));
break;
case "PUT":
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT");
if ($data)
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
break;
}
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
'APIKEY: RegisteredAPIkey',
'Content-Type: application/json',
));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
$result = curl_exec($curl);
if (!$result) {
//echo("Connection failure!");
log_message('critical', "API Connection failure! =>" . $url);
}
curl_close($curl);
return json_decode($result, true);
}
}
+3
View File
@@ -16,6 +16,9 @@ class Home extends BaseController
public function contacts(): string
{
if($_POST){
// var_dump( $_POST );
}
return view('contacts');
}
+29 -9
View File
@@ -15,6 +15,7 @@
left: 50%;
margin-left: -73px;
}
body {
height: 100%;
background: #fafafa;
@@ -22,6 +23,7 @@
color: #777;
font-weight: 300;
}
h1 {
font-weight: lighter;
letter-spacing: normal;
@@ -30,6 +32,7 @@
margin-bottom: 0;
color: #222;
}
.wrap {
max-width: 1024px;
margin: 5rem auto;
@@ -40,10 +43,12 @@
border-radius: 0.5rem;
position: relative;
}
pre {
white-space: normal;
margin-top: 1.5rem;
}
code {
background: #fafafa;
border: 1px solid #efefef;
@@ -51,9 +56,11 @@
border-radius: 5px;
display: block;
}
p {
margin-top: 1.5rem;
}
.footer {
margin-top: 2rem;
border-top: 1px solid #efefef;
@@ -61,24 +68,37 @@
font-size: 85%;
color: #999;
}
a:active,
a:link,
a:visited {
color: #dd4814;
}
</style>
<link rel="shortcut" href="/images/favicon.ico"/>
<link rel="stylesheet" type="text/css" href="stylesheets/style.css"/>
</head>
<body>
<div class="wrap">
<h1>404</h1>
<div class="wrap">
<div class="logo"><a href="/"><img src="/images/logo.png" alt=""/></a></div>
<p>
<?php if (ENVIRONMENT !== 'production') : ?>
<?= nl2br(esc($message)) ?>
<?php else : ?>
<?= lang('Errors.sorryCannotFind') ?>
<?php endif; ?>
</p>
<h1>Page not found</h1>
<p>
<?php if (ENVIRONMENT !== 'production') : ?>
<?= nl2br(esc($message)) ?>
<?php else : ?>
<?= lang('Errors.sorryCannotFind') ?>
<?php endif; ?>
</p>
<p>
<div>
<span><a href="/">Home</a> |</span> <span><a href="/about-us">About us</a> |</span> <span> <a
href="/contacts">Contacts</a> </span>
<!-- <div class="clear"></div>-->
</div>
</p>
</div>
</body>
</html>
+2 -2
View File
@@ -47,11 +47,11 @@
<li class="current-menu-item"><a href="/">Home</a>
</li>
<li><a href="about-us">About us</a>
<li><a href="/about-us">About us</a>
</li>
<li><a href="contacts">Contacts</a></li>
<li><a href="/contacts">Contacts</a></li>
</ul>
+12 -5
View File
@@ -9,17 +9,24 @@ services:
environment:
- APACHE_RUN_USER=#${UID}
- APACHE_RUN_GROUP=#${UID}
#- CI_ENV
- PROVISION_UID=#${PROVISION_UID}
- CONTENTS_SERVER=#${CONTENTS_SERVER}
- SITE_CONTACT_URL=#${SITE_CONTACT_URL}
- TEMPLATE_NAME=p5
- PROVISION_UID=3cc24fd6-e6c7-4c08-8a64-f06e3f790f38
- CI_CONFIG
restart: unless-stopped
volumes:
- ./:/var/www/html
- ./apache_log:/var/log/apache2
ports:
- "${CONTAINER_PORT}:80"
- "${APP_PORT}:80"
extra_hosts:
- "host.docker.internal:host-gateway"
- oameye.works.wrenchboard.com:10.20.30.27
- oameye.work.wrenchboard.com:10.10.33.15
- api.mermsemr.com:10.10.33.15
- devapi.mermsemr.com:10.10.33.15
- devsocket.mermsemr.com:10.10.33.15
- socket.mermsemr.com:10.10.33.15
- dev-media.mermsemr.com:10.10.33.15
- media.mermsemr.com:10.10.33.15
volumes:
src:
+57
View File
@@ -0,0 +1,57 @@
#!/usr/bin/env bash
log() {
local message="$1"
echo -e "\033[32mLog: $message\033[0m"
}
handle_error() {
local error_message="$1"
echo -e "\033[31mError: $error_message\033[0m"
exit 1
}
# Retry logic with exponential backoff
# Usage: retry <command ...args>
# e.g.: retry docker compose down --volumes
retry() {
local max_attempts=5
local attempt=1
local delay=1
while true; do
"$@" && break || {
if [ $attempt -lt $max_attempts ]; then
log "Command failed (attempt $attempt/$max_attempts). Retrying in $delay seconds..."
sleep $delay
delay=$((delay * 2))
((attempt++))
else
handle_error "Command failed after $attempt attempts: $*"
fi
}
done
}
################################################################################
# MAIN
################################################################################
if [ "$1" == "push" ]; then
start:
docker login -u="merms" -p="may12002!" registry.chiefsoft.com
docker tag mermsicare-mermshosted-icare registry.chiefsoft.com/custom/mermsicare-mermshostedicare-001:latest
docker push registry.chiefsoft.com/custom/mermsicare-mermshostedicare-001:latest
elif [ "$1" == "test" ]; then
start:
docker images
else
handle_error "Invalid argument. Use 'dev' or 'test'."
fi