Passed
Pull Request — master (#56)
by
unknown
03:10 queued 01:29
created

S3Factory.create   A

Complexity

Conditions 1

Size

Total Lines 11
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 11
c 0
b 0
f 0
rs 9.85
cc 1
1
import { S3 } from 'aws-sdk';
2
import { Injectable } from '@nestjs/common';
3
import { ConfigService } from '@nestjs/config';
4
5
@Injectable()
6
export class S3Factory {
7
  constructor(
8
    private readonly configService: ConfigService
9
  ) {}
10
11
  create(): S3 {
12
    const accessKeyId = this.configService.get<string>('S3_API_KEY');
13
    const secretAccessKey = this.configService.get<string>('S3_API_SECRET');
14
15
    return new S3({
16
        accessKeyId,
17
        secretAccessKey,
18
        region: 'fr-par',
19
        signatureVersion: 's3v4',
20
        endpoint: 'https://s3.fr-par.scw.cloud'
21
      });
22
  }
23
}
24