Skip to content
Snippets Groups Projects
Commit f8277e80 authored by Marien den Besten's avatar Marien den Besten
Browse files

Apache CGI support

Option to support Apache CGI in combination with custom config directory.
parent 4d876911
No related branches found
No related tags found
No related merge requests found
......@@ -68,6 +68,11 @@ class Config
{
$configDir = dirname(dirname(dirname(__DIR__))) . '/config';
$configDirEnv = getenv('SIMPLESAMLPHP_CONFIG_DIR');
if($configDirEnv === false) {
$configDirEnv = getenv('REDIRECT_SIMPLESAMLPHP_CONFIG_DIR');
}
if ($configDirEnv !== false) {
if (!is_dir($configDirEnv)) {
throw new \InvalidArgumentException(
......
......@@ -34,6 +34,29 @@ class ConfigTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($configDir, __DIR__);
}
/**
* Test valid dir specified by env redirect var overrides default config dir
*/
public function testEnvRedirectVariableConfigDir()
{
putenv('REDIRECT_SIMPLESAMLPHP_CONFIG_DIR=' . __DIR__);
$configDir = Config::getConfigDir();
$this->assertEquals($configDir, __DIR__);
}
/**
* Test which directory takes precedence
*/
public function testEnvRedirectPriorityVariableConfigDir()
{
putenv('SIMPLESAMLPHP_CONFIG_DIR=' . dirname(__DIR__));
putenv('REDIRECT_SIMPLESAMLPHP_CONFIG_DIR=' . __DIR__);
$configDir = Config::getConfigDir();
$this->assertEquals($configDir, dirname(__DIR__));
}
/**
* Test invalid dir specified by env var results in a thrown exception
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment