You are here

protected function S3fsStream::getClient in S3 File System 8.2

Same name and namespace in other branches
  1. 8.3 src/StreamWrapper/S3fsStream.php \Drupal\s3fs\StreamWrapper\S3fsStream::getClient()
  2. 4.0.x src/StreamWrapper/S3fsStream.php \Drupal\s3fs\StreamWrapper\S3fsStream::getClient()
1 call to S3fsStream::getClient()
S3fsStream::__construct in src/StreamWrapper/S3fsStream.php
S3fsStream constructor.

File

src/StreamWrapper/S3fsStream.php, line 245

Class

S3fsStream
Defines a Drupal s3fs (s3fs://) stream wrapper class.

Namespace

Drupal\s3fs\StreamWrapper

Code

protected function getClient() {
  $config = \Drupal::config('s3fs.settings');
  if (!empty($config)) {
    $client = S3Client::factory([
      'credentials' => [
        'key' => $config
          ->get('access_key'),
        'secret' => $config
          ->get('secret_key'),
      ],
      'region' => $config
        ->get('region'),
      'version' => 'latest',
    ]);
    $this->s3 = $client;
  }
}