Webiny\Component\Storage\Driver\AmazonS3\S3StorageDriver::__construct PHP Method

__construct() public method

Constructor
public __construct ( array | ArrayObject $config )
$config array | Webiny\Component\StdLib\StdObject\ArrayObject\ArrayObject
    public function __construct($config)
    {
        if (is_array($config)) {
            $config = new ArrayObject($config);
        }
        if (!$config instanceof ArrayObject) {
            throw new StorageException('Storage driver config must be an array or ArrayObject!');
        }
        $bridge = Storage::getConfig()->get('Bridges.AmazonS3', '\\Webiny\\Component\\Amazon\\S3');
        $accessKeyId = $config->key('AccessKeyId');
        $secretAccessKey = $config->key('SecretAccessKey');
        $region = $config->key('Region');
        $endpoint = $config->key('Endpoint');
        $this->s3Client = new $bridge($accessKeyId, $secretAccessKey, $region, $endpoint);
        $this->bucket = $config->key('Bucket');
        $this->cdnDomain = $config->key('CdnDomain');
        $this->meta = $config->key('Meta');
    }