Last active
August 29, 2015 14:01
-
-
Save eporama/c6edeb3082eda64ff0f2 to your computer and use it in GitHub Desktop.
memcache simplesamlphp config
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// All custom changes below. Modify as needed. | |
// Defines account specific settings. | |
// Set some security and other configs that are set above, however we | |
// overwrite them here to keep all changes in one area | |
$config['technicalcontact_name'] = "Your Name"; | |
$config['technicalcontact_email'] = "[email protected]"; | |
// Change these for your installation | |
$config['secretsalt'] = 'y0h9d13pki9qdhfm3l5nws4jjn55j6hj'; | |
$config['auth.adminpassword'] = 'mysupersecret'; | |
// Prevent Varnish from interfering with SimpleSAMLphp. | |
setcookie('NO_CACHE', '1'); | |
// Non-Acquia environments are set to "local". | |
if (empty($_ENV['AH_SITE_ENVIRONMENT'])) { | |
$_ENV['AH_SITE_ENVIRONMENT'] = 'local'; | |
} | |
// The library gets config for the current environment dynamically. | |
if ($_ENV['AH_SITE_ENVIRONMENT'] != 'local') { | |
$memcache_servers = get_memcache_servers(); | |
$config['store.type'] = 'memcache'; | |
$config['memcache_store.servers'] = array($memcache_servers); | |
// Set log location, as specified by Acquia | |
$config['logging.handler'] = 'file'; | |
$config['loggingdir'] = '/mnt/tmp/' . $_ENV['AH_SITE_NAME']; | |
$config['logging.logfile'] = 'simplesamlphp-' . date("Ymd") . '.log'; | |
// Set baseurlpath to be available correctly for each environment | |
$config['baseurlpath'] = 'https://'.$_SERVER["HTTP_HOST"].'/simplesaml/'; | |
} | |
else { | |
// add any local configuration here | |
} | |
function get_config_info() { | |
$config_json = file_get_contents('/var/www/site-php/' . $_ENV['AH_SITE_NAME'] . '/config.json'); | |
$config = json_decode($config_json, TRUE); | |
return $config; | |
} | |
function get_memcache_servers() { | |
$config = get_config_info(); | |
$memcache_servers = array(); | |
foreach ($config['memcached_servers'] as $memcache_server) { | |
$split = preg_split('/:/', $memcache_server); | |
$memcache_servers[] = array ('hostname' => $split[0], 'port' => $split[1]); | |
} | |
return $memcache_servers; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment