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

S3Factory   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 17
dl 0
loc 17
c 0
b 0
f 0
rs 10

1 Function

Rating   Name   Duplication   Size   Complexity  
A create 0 11 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