Skip to content

Commit

Permalink
fix: ObjectStorage 환경 변수 활용 방식 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
yangchef1 committed Nov 26, 2024
1 parent ab0c04a commit 0424583
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
3 changes: 1 addition & 2 deletions apps/server/src/image/controller/image.controller.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { Body, Controller, Get, Param, Post, Query } from '@nestjs/common';
import { Body, Controller, Get, Param, Post } from '@nestjs/common';
import { ImageService } from '@/image/service/image.service';
import { ResponseMessage } from '@/common/decorator/response-message.decorator';
import { FileNameRequest } from '../dto/file-name-request.dto';
import { Account } from '@/account/entity/account.entity';
import { AuthUser } from '@/account/decorator/authUser.decorator';
import { PresignedUrlResponse } from '../dto/presigned-url-response.dto';

@Controller('image')
export class ImageController {
Expand Down
13 changes: 7 additions & 6 deletions apps/server/src/image/service/image.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,23 @@ import * as dotenv from 'dotenv';
import { UserService } from '@/account/user.service';
import { PresignedUrlResponse } from '../dto/presigned-url-response.dto';
import { AccessUrlResponse } from '../dto/access-url-response.dto';
import { ConfigService } from '@nestjs/config';

dotenv.config();

@Injectable()
export class ImageService {
private readonly s3Client: S3Client;
private readonly userService: UserService;
private readonly bucketName = process.env.OBJECT_STORAGE_BUCKET_NAME;
private readonly bucketName = this.configService.get<string>('OBJECT_STORAGE_BUCKET_NAME');

constructor() {
constructor(private readonly configService: ConfigService) {
this.s3Client = new S3Client({
region: process.env.OBJECT_STORAGE_REGION,
endpoint: process.env.OBJECT_STORAGE_ENDPOINT,
region: this.configService.get<string>('OBJECT_STORAGE_REGION'),
endpoint: this.configService.get<string>('OBJECT_STORAGE_ENDPOINT'),
credentials: {
accessKeyId: process.env.OBJECT_STORAGE_ACCESS_KEY,
secretAccessKey: process.env.OBJECT_STORAGE_SECRET_KEY,
accessKeyId: this.configService.get<string>('OBJECT_STORAGE_ACCESS_KEY'),
secretAccessKey: this.configService.get<string>('OBJECT_STORAGE_SECRET_KEY'),
},
});
}
Expand Down

0 comments on commit 0424583

Please sign in to comment.