1.7.0 • Published 10 months ago

@xnestjs/storage v1.7.0

Weekly downloads
-
License
MIT
Repository
-
Last release
10 months ago

@xnestjs/storage

NestJS extension library for Storage solutions (S3,GS)

Install

npm install @xnestjs/storage
# or using yarn
yarn add @xnestjs/storage

Usage

Register sync

An example of nestjs module that import the @xnestjs/storage

// module.ts
import { Module } from '@nestjs/common';
import { StorageModule } from '@xnestjs/storage';

@Module({
    imports: [
        StorageModule.forRoot({
            useValue: {
                provider: 's3',
                s3: {
                    endPoint: 'play.min.io',
                    port: 9000,
                    useSSL: true,
                    accessKey: 'accessKey',
                    secretKey: 'secretKey',
                },
            },
        }),
    ],
})
export class MyModule {
}

Register async

An example of nestjs module that import the @xnestjs/mongodb async

// module.ts
import { Module } from '@nestjs/common';
import { StorageModule } from '@xnestjs/storage';

@Module({
    imports: [
        StorageModule.forRootAsync({
            inject: [ConfigModule],
            useFactory: (config: ConfigService) => ({
                provider: 's3',
                s3: {
                    endPoint: config.get('S3_ENDPOINT'),
                },
            }),
        }),
    ],
})
export class MyModule {
}

Environment Variables

The library supports configuration through environment variables. Environment variables below is accepted. All environment variables starts with prefix (STORAGE_). This can be configured while registering the module.

<--- BEGIN env --->

Environment VariableTypeDefaultDescription
STORAGE_PROVIDEREnumStorage Provider s3 for Amazon S3

Amazon S3 Environment Variables

Environment VariableTypeDefaultDescription
STORAGE_S3_ENDPOINTStringS3 Endpoint URL
STORAGE_S3_SECRET_KEYString
STORAGE_S3_SSLBoolean
STORAGE_S3_PORTNumber
STORAGE_S3_SESSION_TOKENString
STORAGE_S3_PART_SIZENumber
STORAGE_S3_PATH_STYLEBoolean
STORAGE_S3_SECRET_KEYString
STORAGE_S3_ACC_ENDPOINTString

<--- END env --->

1.7.0

10 months ago

1.6.4

10 months ago

1.6.3

10 months ago

1.6.2

10 months ago

1.5.3

10 months ago

1.6.1

10 months ago

1.5.2

10 months ago

1.6.0

10 months ago

1.2.6

10 months ago

1.5.1

10 months ago

1.2.4

10 months ago

1.5.0

10 months ago

1.3.1

10 months ago

1.2.0

11 months ago

1.2.3

11 months ago

1.2.1

11 months ago

1.1.0

11 months ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago

0.10.4

1 year ago

0.10.0

1 year ago

0.9.0

1 year ago

0.8.2

1 year ago

0.8.1

1 year ago

0.8.0

1 year ago

0.7.1

2 years ago

0.7.0

2 years ago

0.1.0

2 years ago

0.3.0

2 years ago

0.2.0

2 years ago

0.4.0

2 years ago

0.6.1

2 years ago

0.6.0

2 years ago

0.0.1

3 years ago