1diff --git a/classes/utils/Config.class.php b/classes/utils/Config.class.php
2index a4d819bc..318defdf 100644
3--- a/classes/utils/Config.class.php
4+++ b/classes/utils/Config.class.php
5@@ -30,7 +30,7 @@
6 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
7 */
8
9-if (!defined('FILESENDER_BASE')) { // Require environment (fatal)
10+if (!defined('FILESENDER_BASE') || !defined("FILESENDER_CONFIG_DIR")) { // Require environment (fatal)
11 die('Missing environment');
12 }
13
14@@ -116,7 +116,7 @@ class Config
15 }
16
17 // Check if main config exists
18- $main_config_file = FILESENDER_BASE.'/config/config.php';
19+ $main_config_file = FILESENDER_CONFIG_DIR.'/config.php';
20 if (!file_exists($main_config_file)) {
21 throw new ConfigFileMissingException($main_config_file);
22 }
23@@ -136,7 +136,7 @@ class Config
24
25
26 // load password file if it is there
27- $pass_config_file = FILESENDER_BASE.'/config/config-passwords.php';
28+ $pass_config_file = FILESENDER_CONFIG_DIR.'/config-passwords.php';
29 if (file_exists($pass_config_file)) {
30 $config = array();
31 include_once($pass_config_file);
32@@ -153,7 +153,7 @@ class Config
33 throw new ConfigBadParameterException('virtualhost');
34 }
35
36- $config_file = FILESENDER_BASE.'/config/'.$virtualhost.'/config.php';
37+ $config_file = FILESENDER_CONFIG_DIR.$virtualhost.'/config.php';
38 if (!file_exists($config_file)) {
39 throw new ConfigFileMissingException($config_file);
40 } // Should exist even if empty
41@@ -175,7 +175,7 @@ class Config
42 }
43 foreach ($regex_and_configs as $regex => $extra_config_name) {
44 if (preg_match('`'.$regex.'`', $auth_attrs[$attr])) {
45- $extra_config_file = FILESENDER_BASE.'/config/config-' . $extra_config_name . '.php';
46+ $extra_config_file = FILESENDER_CONFIG_DIR.'/config-' . $extra_config_name . '.php';
47 if (file_exists($extra_config_file)) {
48 $config = array();
49 include_once($extra_config_file);
50@@ -204,7 +204,7 @@ class Config
51 // Load config overrides if any
52 $overrides_cfg = self::get('config_overrides');
53 if ($overrides_cfg) {
54- $overrides_file = FILESENDER_BASE.'/config/'.($virtualhost ? $virtualhost.'/' : '').'config_overrides.json';
55+ $overrides_file = FILESENDER_CONFIG_DIR.($virtualhost ? $virtualhost.'/' : '').'config_overrides.json';
56
57 $overrides = file_exists($overrides_file) ? json_decode(trim(file_get_contents($overrides_file))) : new StdClass();
58
59@@ -431,7 +431,7 @@ class Config
60 public static function getVirtualhosts()
61 {
62 $virtualhosts = array();
63- foreach (scandir(FILESENDER_BASE.'/config') as $item) {
64+ foreach (scandir(FILESENDER_CONFIG_DIR) as $item) {
65 if (!preg_match('`^(.+)\.conf\.php$`', $item, $match)) {
66 continue;
67 }
68diff --git a/config/csrf-protector-config.php b/config/csrf-protector-config.php
69index 83759ca4..ea4a3173 100755
70--- a/config/csrf-protector-config.php
71+++ b/config/csrf-protector-config.php
72@@ -40,7 +40,7 @@ return array(
73 // The following should be set correctly from your config.php
74 // information
75 "jsUrl" => $config['site_url'] . "/js/csrfprotector.js",
76- "logDirectory" => FILESENDER_BASE.'/log/',
77+ "logDirectory" => FILESENDER_LOG_DIR,
78
79 // I found that leaving this with the _ as default
80 // caused the implicit token to be stripped
81diff --git a/includes/ConfigDefaults.php b/includes/ConfigDefaults.php
82index 733550e7..8d99b5f0 100644
83--- a/includes/ConfigDefaults.php
84+++ b/includes/ConfigDefaults.php
85@@ -224,7 +224,7 @@ $default = array(
86 'log_facilities' => array(
87 array(
88 'type' => 'file',
89- 'path' => FILESENDER_BASE.'/log/',
90+ 'path' => FILESENDER_LOG_DIR,
91 'rotate' => 'hourly'
92 )
93 ),
94diff --git a/includes/ConfigValidation.php b/includes/ConfigValidation.php
95index 5c1e7f61..b1fb57e4 100644
96--- a/includes/ConfigValidation.php
97+++ b/includes/ConfigValidation.php
98@@ -31,9 +31,9 @@
99 */
100
101 // Require environment (fatal)
102-if(!defined('FILESENDER_BASE')) die('Missing environment');
103+if(!defined('FILESENDER_BASE') || !defined("FILESENDER_CONFIG_DIR")) die('Missing environment');
104
105-if(!file_exists(FILESENDER_BASE.'/config/config.php'))
106+if(!file_exists(FILESENDER_CONFIG_DIR.'/config.php'))
107 die('Configuration file not found');
108
109 ConfigValidator::addCheck('site_url', 'string');
110diff --git a/includes/init.php b/includes/init.php
111index ba7fa82f..31812c54 100644
112--- a/includes/init.php
113+++ b/includes/init.php
114@@ -35,6 +35,8 @@ if(PHP_INT_SIZE !== 8) {
115 }
116
117 define('FILESENDER_BASE', dirname( __DIR__ ));
118+define('FILESENDER_CONFIG_DIR', getenv('FILESENDER_CONFIG_DIR', true) ?: (FILESENDER_BASE.'/config'));
119+define('FILESENDER_LOG_DIR', getenv('FILESENDER_LOG_DIR', true) ?: (FILESENDER_BASE.'/log'));
120
121 // Include classes autoloader
122 require_once(FILESENDER_BASE.'/classes/autoload.php');