Skip to content
This repository has been archived by the owner on Sep 10, 2021. It is now read-only.

Commit

Permalink
Allow writable folder locations to be specified by environment vars
Browse files Browse the repository at this point in the history
  • Loading branch information
Jamie Snape committed Jun 30, 2014
1 parent cfdb680 commit 64851b7
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 4 deletions.
20 changes: 18 additions & 2 deletions core/constant/global.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,24 @@
=========================================================================*/

define('CORE_CONFIGS_PATH', BASE_PATH . '/core/configs');
define('LOCAL_CONFIGS_PATH', CORE_CONFIGS_PATH);
define('LOGS_PATH', BASE_PATH . '/log');

if(getenv('midas_local_configs_path') !== false)
{
define('LOCAL_CONFIGS_PATH', getenv('midas_local_configs_path'));
}
else
{
define('LOCAL_CONFIGS_PATH', CORE_CONFIGS_PATH);
}

if(getenv('midas_logs_path') !== false)
{
define('LOGS_PATH', getenv('midas_logs_path'));
}
else
{
define('LOGS_PATH', BASE_PATH . '/log');
}

if(file_exists(LOCAL_CONFIGS_PATH . '/core.local.ini'))
{
Expand Down
18 changes: 16 additions & 2 deletions core/controllers/components/UtilityComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,14 @@ public static function getDataDirectory($subdir = '')
}
if(!isset($dataDirectory) || empty($dataDirectory))
{
$dataDirectory = BASE_PATH.'/data';
if(getenv('midas_data_path') !== false)
{
$dataDirectory = getenv('midas_data_path');
}
else
{
$dataDirectory = BASE_PATH.'/data';
}
}
if($subdir == '')
{
Expand Down Expand Up @@ -441,7 +448,14 @@ public static function getTempDirectory($subdir = "misc")
}
if(!isset($tempDirectory) || empty($tempDirectory))
{
$tempDirectory = BASE_PATH.'/tmp';
if(getenv('midas_temp_path') !== false)
{
$tempDirectory = getenv('midas_temp_path');
}
else
{
$tempDirectory = BASE_PATH.'/tmp';
}
}
return $tempDirectory .'/'.$subdir.'/';
}
Expand Down

0 comments on commit 64851b7

Please sign in to comment.