AdonisJS API
    Preparing search index...

    ConfigManager handles loading, parsing, and managing application configuration. It can load configuration from file system directories or use explicitly provided configuration objects (useful for testing).

    The manager creates a Config instance that provides type-safe access to configuration values throughout the application.

    const manager = new ConfigManager(new URL('file:///app/'))
    await manager.process('config')
    const dbConfig = manager.config.get('database')
    // Using explicit config for testing
    const manager = new ConfigManager(appRoot)
    manager.useConfig({ database: { connection: 'sqlite' } })
    await manager.process('config')
    Index
    config: Config

    Reference to the Config instance that provides access to all configuration values. Available after process() method has been called.

    • Provides configuration values programmatically instead of loading from files. Useful for testing or when configuration needs to be generated dynamically. Calling this method disables reading config files from the file system.

      Parameters

      • values: Record<any, any>

        The configuration values to use

      Returns this

      Returns the ConfigManager instance for method chaining

    • Loads and processes configuration values. If useConfig() was called, uses those values; otherwise loads config files from the specified directory. Creates a Config instance accessible via the config property.

      Parameters

      • configDirectory: string

        The directory path containing config files (relative to appRoot)

      Returns Promise<void>

      Promise that resolves when config processing is complete