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

api/src/Infrastructure/Ingestion/S3Factory.ts   A

Complexity

Total Complexity 1
Complexity/F 1

Size

Lines of Code 24
Function Count 1

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 20
mnd 0
bc 0
fnc 1
dl 0
loc 24
bpm 0
cpm 1
noi 0
c 0
b 0
f 0
rs 10

1 Function

Rating   Name   Duplication   Size   Complexity  
A S3Factory.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