βοΈ@hsuite/smart-config - Configuration Management
βοΈ Dynamic configuration management for HSuite applications
Advanced configuration management module providing environment-based settings, secure credential management, and dynamic configuration updates for distributed blockchain applications.
Table of Contents
Quick Start
Installation
npm install @hsuite/smart-configBasic Setup
Basic Usage
Architecture
Core Components
βοΈ Configuration Management
SmartConfigService- Core configuration service with type safetyEnvironment Loading - Multi-environment configuration support
Dynamic Updates - Runtime configuration updates
π Security Features
Credential Encryption - Automatic encryption for sensitive values
Secret Management - Secure handling of API keys and passwords
Environment Isolation - Separate configs for different environments
π Dynamic Configuration
Hot Reloading - Configuration updates without restart
Validation - Schema-based configuration validation
Type Safety - Full TypeScript support for configuration objects
Module Structure
API Reference
SmartConfigModule
Static Methods
forRoot(options: SmartConfigOptions): DynamicModule
Configures the smart config module with static options.
forRootAsync(options: SmartConfigAsyncOptions): DynamicModule
Configures the smart config module with async dependency injection.
SmartConfigService
Core Methods
get<T = any>(key: string, defaultValue?: T): T
Retrieves configuration value by key
Parameters:
key- Configuration key,defaultValue- Fallback valueReturns: Configuration value or default
getOrThrow<T = any>(key: string): T
Gets configuration value or throws error if not found
Parameters:
key- Configuration keyThrows:
Errorif key not found
getDatabaseConfig(): DatabaseConfig
Returns typed database configuration
Returns: Complete database configuration object
getAuthConfig(): AuthConfig
Returns authentication configuration
Returns: Authentication settings with type safety
getNetworkConfig(): NetworkConfig
Returns network and blockchain configuration
Returns: Network configuration for all supported chains
Guides
Environment Configuration Guide
Learn how to set up environment-specific configurations and secrets. Configure validation schemas, environment variable management, and secure credential handling.
Dynamic Updates Guide
Implement runtime configuration updates and hot reloading. Set up configuration watchers, event-driven updates, and real-time configuration management.
Validation Guide
Set up configuration validation schemas and type safety. Implement Joi validation, custom validators, and configuration error handling.
Examples
Complete Module Configuration
Environment-Specific Configuration
Dynamic Configuration Updates
Configuration Validation Service
Integration
Required Dependencies
Environment File Structure
Production Environment
βοΈ Type Safety: Full TypeScript support with configuration interfaces and validation.
π Security: Encrypted credential storage and environment-based configuration isolation.
π Dynamic: Runtime configuration updates with validation and event emission.
Built with β€οΈ by the HSuite Team Copyright Β© 2025 HSuite. All rights reserved.
Last updated