import { Module } from "@nestjs/common"; import { ConfigService } from "@nestjs/config"; import type {} from "multer"; import { MinioModule } from "nestjs-minio-client"; import { Config } from "../config/schema"; import { StorageController } from "./storage.controller"; import { StorageService } from "./storage.service"; @Module({ imports: [ MinioModule.registerAsync({ inject: [ConfigService], useFactory: (configService: ConfigService) => ({ endPoint: configService.getOrThrow("STORAGE_ENDPOINT"), port: configService.getOrThrow("STORAGE_PORT"), region: configService.get("STORAGE_REGION"), accessKey: configService.getOrThrow("STORAGE_ACCESS_KEY"), secretKey: configService.getOrThrow("STORAGE_SECRET_KEY"), useSSL: configService.getOrThrow("STORAGE_USE_SSL"), }), }), ], controllers: [StorageController], providers: [StorageService], exports: [StorageService], }) export class StorageModule {}