configuration file modification, docker environment variable support
This commit is contained in:
committed by
giandonato.inverso@edempg.it
parent
21b779c581
commit
fef45c401a
@@ -15,13 +15,16 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- "8080:80"
|
- "8080:80"
|
||||||
user: "${PUID}:${PGID}"
|
user: "${PUID}:${PGID}"
|
||||||
#environment:
|
environment:
|
||||||
#ADMIN_USER: "superadmin" # not supported yet please see road map
|
ADMIN_USER: "superadmin"
|
||||||
#ADMIN_PASSWORD: "superadmin" # not supported yet please see road map
|
ADMIN_PASSWORD: "superadmin"
|
||||||
#DATABASE_HOST: "mariadb" # not supported yet please see road map
|
DATABASE_HOST: "mariadb"
|
||||||
#DATABASE_NAME: "qrcode" # not supported yet please see road map
|
DATABASE_PORT: "3306"
|
||||||
#DATABASE_USER: "qrcode" # not supported yet please see road map
|
DATABASE_NAME: "qrcode"
|
||||||
#DATABASE_PASSWORD: "changeme" # not supported yet please see road map
|
DATABASE_USER: "qrcode"
|
||||||
|
DATABASE_PASSWORD: "changeme"
|
||||||
|
DATABASE_PREFIX: ""
|
||||||
|
DATABASE_CHARSET: "utf8"
|
||||||
volumes:
|
volumes:
|
||||||
- ./data/app/config:/var/www/html/config
|
- ./data/app/config:/var/www/html/config
|
||||||
- ./data/app/saved_qrcode:/var/www/html/saved_qrcode
|
- ./data/app/saved_qrcode:/var/www/html/saved_qrcode
|
||||||
|
|||||||
Executable
+35
@@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once ('environment.php');
|
||||||
|
|
||||||
|
//Note: This file should be included first in every php page.
|
||||||
|
error_reporting(E_ALL);
|
||||||
|
ini_set('display_errors', 'On');
|
||||||
|
define('BASE_PATH', dirname(dirname(__FILE__)));
|
||||||
|
define('APP_FOLDER', 'simpleadmin');
|
||||||
|
define('CURRENT_PAGE', basename($_SERVER['REQUEST_URI']));
|
||||||
|
|
||||||
|
/* PATH OF SAVED QR CODES */
|
||||||
|
define('PATH', './saved_qrcode/'); //You can change the folder where the qr code will be saved
|
||||||
|
define('DIRECTORY', BASE_PATH.'/saved_qrcode/');
|
||||||
|
|
||||||
|
//You can change the page name for the redirect and the search parameter (the default is "id")
|
||||||
|
define('READ_PATH', $_SERVER['HTTP_HOST'].'/read.php?id=');
|
||||||
|
|
||||||
|
require_once BASE_PATH . '/lib/MysqliDb/MysqliDb.php';
|
||||||
|
require_once BASE_PATH . '/helpers/helpers.php';
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get instance of DB object
|
||||||
|
*/
|
||||||
|
function getDbInstance() {
|
||||||
|
return new MysqliDb (Array (
|
||||||
|
'host' => DATABASE_HOST,
|
||||||
|
'username' => DATABASE_USER,
|
||||||
|
'password' => DATABASE_PASSWORD,
|
||||||
|
'db'=> DATABASE_NAME,
|
||||||
|
'port' => DATABASE_PORT,
|
||||||
|
'prefix' => DATABASE_PREFIX,
|
||||||
|
'charset' => DATABASE_CHARSET));
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| DOCKER INSTALLATION
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
$docker_cid = getenv('DOCKER_CID');
|
||||||
|
|
||||||
|
if(is_string($docker_cid)) {
|
||||||
|
define('DATABASE_HOST', Getenv('DATABASE_HOST'));
|
||||||
|
define('DATABASE_PORT', filter_var(Getenv('DATABASE_PORT'), FILTER_VALIDATE_INT));
|
||||||
|
define('DATABASE_NAME', Getenv('DATABASE_NAME'));
|
||||||
|
define('DATABASE_USER', Getenv('DATABASE_USER'));
|
||||||
|
define('DATABASE_PASSWORD', Getenv('DATABASE_PASSWORD'));
|
||||||
|
define('DATABASE_PREFIX', Getenv('DATABASE_PREFIX'));
|
||||||
|
define('DATABASE_CHARSET', Getenv('DATABASE_CHARSET'));
|
||||||
|
} else {
|
||||||
|
define('DATABASE_HOST', "localhost");
|
||||||
|
define('DATABASE_PORT', "3306");
|
||||||
|
define('DATABASE_NAME', "qrcode");
|
||||||
|
define('DATABASE_USER', "root");
|
||||||
|
define('DATABASE_PASSWORD', "root");
|
||||||
|
define('DATABASE_PREFIX', "");
|
||||||
|
define('DATABASE_CHARSET', "utf8");
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| INSTALLATION WITHOUT CONTAINER
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
?>
|
||||||
Reference in New Issue
Block a user