Storage Configuration

Overview

This module provides types and configurations to define the storage provider and its settings. It supports multiple storage options, including Local, S3, and MinIO, enabling flexible integration with different storage backends.

Types

1. StorageProvider

Specifies the type of storage backend.

Definition

export type StorageProvider = 'LOCAL' | 'S3' | 'MINIO';

Values

  • LOCAL: Indicates local file storage.

  • S3: Refers to Amazon S3 cloud storage.

  • MINIO: Denotes MinIO, an S3-compatible storage service

2. LocalStorageConfig

Defines configuration for local file storage.

Definition

export type LocalStorageConfig = {
    provider: 'LOCAL';
    uploadDir: string;
    baseUrl: string;
};

Properties

  • provider: Always set to 'LOCAL' for local storage.

  • uploadDir: Directory path where files will be stored locally.

  • baseUrl: Base URL used to access files (e.g., http://example.com/uploads).

Example

3. S3StorageConfig

Defines configuration for Amazon S3 storage.

Definition

Properties

  • provider: Always set to 'S3' for Amazon S3 storage.

  • accessKeyId: AWS access key ID.

  • secretAccessKey: AWS secret access key.

  • region: AWS region where the S3 bucket resides.

  • bucket: Name of the S3 bucket.

Example

4. MinioStorageConfig

Defines configuration for MinIO, an S3-compatible storage service.

Definition

Properties

  • provider: Always set to 'MINIO' for MinIO storage.

  • endPoint: Hostname or IP address of the MinIO server.

  • port?: (Optional) Port number of the MinIO server.

  • useSSL: Indicates whether SSL/TLS should be used for communication.

  • accessKey: MinIO access key.

  • secretKey: MinIO secret key.

  • bucket: Name of the storage bucket.

Example

5. StorageConfig

A union type that combines all storage configuration types.

Definition

Usage

The StorageConfig type allows for flexible assignment depending on the chosen provider.

Example

Interfaces

1. AsyncStorageManagerModuleFactoryOptions

Defines the configuration for asynchronously loading storage settings.

Definition

Properties

  • imports: (Optional) Modules to import for dependency injection.

  • useFactory: A factory function to provide the StorageConfig either synchronously or asynchronously.

  • inject?: (Optional) Dependencies to inject into the factory function.

Example

Last updated