1.0.0 • Published 4 years ago
@ether-healthcare/minio-client v1.0.0
Description
This package is provided by Ether Healthcare® for connection Nest app to Minio
Installation
# npm
npm i @ether-healthcare/minio-client
# yarn
yarn add @ether-healthcare/minio-client
Configuration
create bucket.config.ts in src/config with these lines
import { registerAs } from '@nestjs/config'
import { ClientOptions } from 'minio'
export default registerAs(
'bucket',
() =>
({
endPoint: process.env.MINIO_HOST,
port: +process.env.MINIO_PORT,
useSSL: false,
accessKey: process.env.MINIO_ACCESS_KEY,
secretKey: process.env.MINIO_SECRET_KEY,
} as ClientOptions),
)
And load from the ConfigModule in AppModule
ConfigModule.forRoot({
load: [bucketConfig],
}),
Register MinioModule like these
MinioModule.registerAsync({
imports: [ConfigModule],
inject: [ConfigService],
useFactory: async (configService: ConfigService) =>
configService.get('bucket'),
})
You can now call the minioService
this.minioService.createBucket(bucketName)
That's it
License
Ether Healthcare® Minio Client is MIT licensed.