AcsfConfigDefault.php in Acquia Cloud Site Factory Connector 8.2
File
src/AcsfConfigDefault.php
View source
<?php
namespace Drupal\acsf;
class AcsfConfigDefault extends AcsfConfig {
protected static $cacheDefault;
protected function loadConfig() {
if (empty(self::$cacheDefault)) {
self::$cacheDefault = new \stdClass();
$this
->loadIniFile();
}
$this->url = self::$cacheDefault->url;
$this->username = self::$cacheDefault->username;
$this->password = self::$cacheDefault->password;
$this->urlSuffix = self::$cacheDefault->urlSuffix;
$this->sourceUrl = self::$cacheDefault->sourceUrl;
}
protected function loadIniFile() {
$ini_file = sprintf('/mnt/files/%s.%s/nobackup/sf_shared_creds.ini', $this->ahSite, $this->ahEnv);
$acsf_shared_creds = parse_ini_file($ini_file, TRUE);
if (empty($acsf_shared_creds['gardener'])) {
throw new AcsfConfigMissingCredsException(sprintf('Shared credential file not found in /mnt/files/%s.%s/nobackup/.', $this->ahSite, $this->ahEnv));
}
self::$cacheDefault->url = $acsf_shared_creds['gardener']['url'];
self::$cacheDefault->username = $acsf_shared_creds['gardener']['username'];
self::$cacheDefault->password = $acsf_shared_creds['gardener']['password'];
if (isset($acsf_shared_creds['gardener']['url_suffix'])) {
self::$cacheDefault->urlSuffix = $acsf_shared_creds['gardener']['url_suffix'];
}
else {
self::$cacheDefault->urlSuffix = '';
}
if (isset($acsf_shared_creds['gardener']['source_url'])) {
self::$cacheDefault->sourceUrl = $acsf_shared_creds['gardener']['source_url'];
}
else {
self::$cacheDefault->sourceUrl = '';
}
}
}