Logos DX
    Preparing search index...

    Type Alias NestedConfig<C, F>

    type NestedConfig<C extends object, F extends object> = {
        allConfigs: () => C;
        getConfig: <P extends PathLeaves<C>, D extends PathValue<C, P>>(
            path: P,
            defaultValue?: D,
        ) => PathValue<C, P>;
        setDeepInParsedConfig: (
            override: [PathNames<DeepOptional<C>>, unknown][],
        ) => void;
        updateFlatConfig: (override: Partial<F>) => void;
        updateParsedConfig: (override: DeepOptional<C>) => void;
    }

    Type Parameters

    • C extends object
    • F extends object
    Index

    Properties

    allConfigs: () => C

    Get the entire parsed config object.

    Every call returns a detached copy — mutating the returned object never affects the cached config or later reads.

    Type Declaration

      • (): C
      • Returns C

        The parsed config object.

    getConfig: <P extends PathLeaves<C>, D extends PathValue<C, P>>(
        path: P,
        defaultValue?: D,
    ) => PathValue<C, P>

    Get a specific config value by path.

    Type Declaration

      • <P extends PathLeaves<C>, D extends PathValue<C, P>>(
            path: P,
            defaultValue?: D,
        ): PathValue<C, P>
      • Type Parameters

        Parameters

        • path: P

          The path to the config value.

        • OptionaldefaultValue: D

          Optional default value to return if the path is not found.

        Returns PathValue<C, P>

        The config value at the specified path.

    const value = config.getConfig('database.host');
    
    setDeepInParsedConfig: (
        override: [PathNames<DeepOptional<C>>, unknown][],
    ) => void

    Set the parsed configuration to a deep override.

    Type Declaration

    config.setDeepInParsedConfig([['database.host', 'localhost']]);
    
    updateFlatConfig: (override: Partial<F>) => void

    Update the flatmap configuration with a partial override.

    Type Declaration

      • (override: Partial<F>): void
      • Parameters

        • override: Partial<F>

          The partial override object to apply.

        Returns void

    If override is not a non-null object.

    config.updateFlatConfig({ 'APP_DATABASE_HOST': 'localhost' });
    
    updateParsedConfig: (override: DeepOptional<C>) => void

    Update the parsed configuration with a partial override. The override is deep-merged, so nested objects only need the keys being changed. Accumulates across calls and survives re-parses triggered by updateFlatConfig.

    Type Declaration

    If override is not a non-null object.

    config.updateParsedConfig({ database: { host: 'localhost' } });