Refactor RBAC migration scripts and update configuration handling
- Removed old migration scripts for profiles and users to RBAC. - Updated config redirector to utilize environment variables for configuration loading. - Added .gitignore files to firmware, log, and marketing directories to prevent unnecessary file tracking. - Introduced new configuration files for acceptance, development, and production environments with relevant settings. - Enhanced settings files to include exception lists, security keys, and database settings.
This commit is contained in:
@@ -1,31 +1,11 @@
|
||||
<?php
|
||||
|
||||
//=========================================
|
||||
//REDIRECTOR TO CONFIG FILE BASED ON DOMAIN
|
||||
//=========================================
|
||||
function getDomain($hostname) {
|
||||
// Extract the domain parts
|
||||
$parts = explode('.', $hostname);
|
||||
$count = count($parts);
|
||||
|
||||
// For hostnames with enough parts to have a subdomain (at least 3 parts)
|
||||
if ($count >= 3) {
|
||||
// Return the second-to-last and third-to-last parts
|
||||
return $parts[$count - 2];
|
||||
}
|
||||
// For hostnames with just domain and TLD (2 parts)
|
||||
else if ($count == 2) {
|
||||
// Return just the domain part (without the TLD)
|
||||
return $parts[0];
|
||||
}
|
||||
// If it's a single part hostname
|
||||
else {
|
||||
return $hostname;
|
||||
}
|
||||
}
|
||||
//======================================================================
|
||||
//REDIRECTOR TO CONFIG FILE BASED ON .htacces - SetEnv APP_ENV development
|
||||
//======================================================================
|
||||
$env = getenv('APP_ENV') ?: 'development';
|
||||
|
||||
$domain = getDomain($_SERVER['SERVER_NAME']);
|
||||
$config_location = ((file_exists(dirname(__FILE__,2).'/custom/'.$domain.'/settings/'.$domain.'_config.php')) ? dirname(__FILE__,2).'/custom/'.$domain.'/settings/'.$domain.'_config.php' : dirname(__FILE__).'/config.php');
|
||||
$config_location = ((file_exists(dirname(__FILE__,2).'/custom/'.$env.'/settings/'.$env.'_config.php')) ? dirname(__FILE__,2).'/custom/'.$env.'/settings/'.$env.'_config.php' : dirname(__FILE__).'/'.$env.'_config.php');
|
||||
|
||||
include $config_location;
|
||||
?>
|
||||
Reference in New Issue
Block a user