bug fix redirect url with docker installation
This commit is contained in:
committed by
giandonato.inverso@edempg.it
parent
0360176490
commit
8a926ac0f3
+1
-1
@@ -5,6 +5,7 @@ services:
|
||||
restart: "unless-stopped"
|
||||
environment:
|
||||
TYPE: "docker"
|
||||
BASE_URL: "https://mydomain.com"
|
||||
DATABASE_HOST: "php-dynamic-qrcode-db"
|
||||
DATABASE_PORT: "3306"
|
||||
DATABASE_NAME: "qrcode"
|
||||
@@ -17,7 +18,6 @@ services:
|
||||
depends_on:
|
||||
- php-dynamic-qrcode-db
|
||||
volumes:
|
||||
- php_dynamic_qrcode_config_data:/var/www/html/config
|
||||
- php_dynamic_qrcode_saved_qrcode_data:/var/www/html/saved_qrcode
|
||||
networks:
|
||||
- php-dynamic-qrcode-network
|
||||
|
||||
@@ -13,6 +13,8 @@ if(is_string(Getenv('TYPE')) && Getenv('TYPE') == "docker") {
|
||||
define('DATABASE_PASSWORD', Getenv('DATABASE_PASSWORD'));
|
||||
define('DATABASE_PREFIX', Getenv('DATABASE_PREFIX')); // This must have a trailing underscore. Example: qr_
|
||||
define('DATABASE_CHARSET', Getenv('DATABASE_CHARSET'));
|
||||
define('TYPE', Getenv('TYPE'));
|
||||
define('BASE_URL', Getenv('BASE_URL'));
|
||||
} else {
|
||||
define('DATABASE_HOST', "localhost");
|
||||
define('DATABASE_PORT', "3306");
|
||||
|
||||
@@ -117,11 +117,16 @@ function paginationLinks($current_page, $total_pages, $base_url) {
|
||||
return $html;
|
||||
}
|
||||
|
||||
function base_url(){
|
||||
function base_url() {
|
||||
require_once(__DIR__ . '/../config/environment.php');
|
||||
if (defined('BASE_URL') && BASE_URL !== null) {
|
||||
return BASE_URL;
|
||||
} else {
|
||||
return sprintf(
|
||||
"%s://%s:%s",
|
||||
isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? 'https' : 'http',
|
||||
isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' ? 'https' : 'http',
|
||||
$_SERVER['SERVER_NAME'],
|
||||
$_SERVER['SERVER_PORT']
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user