$params['environment'] = !isset($arguments[2]) ? $cont->environment : null; } $config = $cont->config; $proxySettings = null; if ($config('scalr.aws.use_proxy') && in_array($config('scalr.connections.proxy.use_on'), array('both', 'scalr'))) { $proxySettings = $config('scalr.connections.proxy'); } $serviceid = 'aws.' . hash('sha256', sprintf("%s|%s|%s|%s|%s", $params['accessKeyId'], $params['secretAccessKey'], $params['region'], !empty($params['certificate']) ? crc32($params['certificate']) : '-', !empty($params['privateKey']) ? crc32($params['privateKey']) : '-'), false); if (!$cont->initialized($serviceid)) { $cont->setShared($serviceid, function ($cont) use($params, $proxySettings) { if (empty($params['secretAccessKey']) || empty($params['accessKeyId'])) { throw new \Scalr\Exception\InvalidCloudCredentialsException(); } $aws = new \Scalr\Service\Aws($params['accessKeyId'], $params['secretAccessKey'], $params['region'], $params['certificate'], $params['privateKey']); if ($proxySettings !== null) { $aws->setProxy($proxySettings['host'], $proxySettings['port'], $proxySettings['user'], $proxySettings['pass'], $proxySettings['type']); } $observer = new \Scalr\Service\Aws\Plugin\EventObserver($aws); $aws->setEventObserver($observer); if (isset($params['environment']) && $params['environment'] instanceof \Scalr_Environment) { $aws->setEnvironment($params['environment']); } return $aws; }); } return $cont->get($serviceid); }; $container->setShared('auditLogStorage', function ($cont) { $type = 'Mysql'; $storageClass = 'Scalr\\Logger\\' . $type . 'LoggerStorage'; return new $storageClass(array('dsn' => $cont->{'dsn.getter'}('scalr.connections.mysql')));