forked from yy0ung/nibobnebob
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat : object storage를 관리하기 위한 모듈 및 서비스 생성 #35
- aws 모듈,서비스 생성 - s3 객체 인스턴스 생성 Co-authored-by: GeunH <[email protected]>
- Loading branch information
Showing
5 changed files
with
49 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
|
||
#config | ||
typeorm.config.ts | ||
objectStorage.config.json | ||
objectStorage.config.ts | ||
|
||
# Logs | ||
logs | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { Global, Module } from '@nestjs/common'; | ||
import { AwsService } from './aws.service'; | ||
|
||
@Global() | ||
@Module({ | ||
providers: [AwsService], | ||
exports: [AwsService], | ||
}) | ||
export class AwsModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Test, TestingModule } from '@nestjs/testing'; | ||
import { AwsService } from './aws.service'; | ||
|
||
describe('AwsService', () => { | ||
let service: AwsService; | ||
|
||
beforeEach(async () => { | ||
const module: TestingModule = await Test.createTestingModule({ | ||
providers: [AwsService], | ||
}).compile(); | ||
|
||
service = module.get<AwsService>(AwsService); | ||
}); | ||
|
||
it('should be defined', () => { | ||
expect(service).toBeDefined(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { Injectable } from '@nestjs/common'; | ||
import * as AWS from 'aws-sdk'; | ||
import { awsConfig } from 'objectStorage.config'; | ||
|
||
@Injectable() | ||
export class AwsService { | ||
private s3: AWS.S3; | ||
|
||
constructor() { | ||
this.s3 = new AWS.S3({ | ||
endpoint: awsConfig.endpoint, | ||
region: awsConfig.region, | ||
credentials: { | ||
accessKeyId: awsConfig.accessKey, | ||
secretAccessKey: awsConfig.secretKey | ||
}, | ||
}); | ||
} | ||
} |