File size: 1,043 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
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<Config>) => ({
endPoint: configService.getOrThrow<string>("STORAGE_ENDPOINT"),
port: configService.getOrThrow<number>("STORAGE_PORT"),
region: configService.get<string>("STORAGE_REGION"),
accessKey: configService.getOrThrow<string>("STORAGE_ACCESS_KEY"),
secretKey: configService.getOrThrow<string>("STORAGE_SECRET_KEY"),
useSSL: configService.getOrThrow<boolean>("STORAGE_USE_SSL"),
}),
}),
],
controllers: [StorageController],
providers: [StorageService],
exports: [StorageService],
})
export class StorageModule {}
|