igcv3 - v1.1.0
    Preparing search index...

    Class ConfigService

    Index

    Constructors

    Properties

    config: AppConfig
    loadedConfigPath: string | null = null
    isTestEnv: boolean
    internalConfigLoaded: boolean = false

    Methods

    • Load internal default configuration from bundled YAML file. Uses Zod validation with type-safe parsing.

      Parameters

      • filePath: string

      Returns Promise<boolean>

    • Load configuration from multiple sources in cascading order.

      1. Internal Defaults (loaded once before cascade)
      2. System Config (/etc/igcv3/igcv3.conf.yml)
      3. User Config (~/.config/igcv3/igcv3.conf.yml)
      4. Local Config (./igcv3.conf.yml)
      5. Custom Config File (--config path)

      Parameters

      • OptionalcustomPath: string

      Returns Promise<void>

    • Load configuration from a file with Zod validation.

      Parameters

      • filePath: string

        Path to the configuration file

      Returns Promise<boolean>

      True if the file was loaded successfully

    • Type-safe shallow merge helper.

      Type Parameters

      • T extends object

      Parameters

      • base: T

        Base object to merge into

      • override: Partial<T> | undefined

        Partial object to merge from (Zod-validated)

      Returns T

      Merged object with base type preserved

    • Type-safe deep merge helper for nested configuration objects. Uses explicit key iteration to avoid Record<string, unknown> casts.

      Type Parameters

      • T extends object

        Base type of the object being merged

      • K extends string | number | symbol

        Keys of T that should be deep-merged

      Parameters

      • base: T

        Base object to merge into

      • override: Partial<T> | undefined

        Partial object to merge from (Zod-validated)

      • nestedKeys: K[]

        Keys that should be deep-merged one level

      Returns T

      Merged object with proper typing

    • Merge UI configuration section.

      Parameters

      • ui:
            | {
                clearOnBanner?: boolean;
                showBanner?: boolean;
                serialFormat?: "hex"
                | "colon";
            }
            | undefined

      Returns void

    • Merge PKI configuration section (deep merge).

      Parameters

      • pki:
            | {
                defaults?: {
                    countryName?: string;
                    stateOrProvinceName?: string;
                    localityName?: string;
                    organizationName?: string;
                    organizationalUnitName?: string;
                    validityDays?: number;
                    preset?: string;
                };
                keys?: | { algo: "rsa"; size: 2048
                | 4096; encoding: "pem" | "der" }
                | {
                    algo: "ecdsa";
                    curve: "P-256" | "P-384" | "P-521";
                    encoding: "pem" | "der";
                }
                | { algo: "ed25519"; encoding: "pem"
                | "der" };
                csr?: {
                    signature?: "sha256" | "sha384" | "sha512";
                    encoding?: "pem" | "der";
                };
                interactive?: boolean;
                sanitizeName?: boolean;
                mergePresets?: boolean;
            }
            | undefined

      Returns void

    • Merge storage configuration section (deep merge).

      Parameters

      • storage:
            | {
                paths?: {
                    output?: string;
                    archive?: string;
                    allowedOutputDirs?: string[];
                };
                filename?: { format?: string; timestampFormat?: string };
                conflict?: {
                    strategy?: "error" | "archive" | "overwrite";
                    archiveFormat?: string;
                };
            }
            | undefined

      Returns void

    • Merge presets configuration (conditional merge vs replace).

      Parameters

      • presets:
            | Record<
                string,
                {
                    description: string;
                    organizationalUnitName?: string
                    | string[];
                    validityDays?: number;
                    extensions?: { serverAuth?: boolean; clientAuth?: boolean };
                    variables?: Record<
                        string,
                        {
                            type: "input"
                            | "list";
                            message: string;
                            validate?: string;
                            choices?: string[];
                            default?: string;
                        },
                    >;
                    subjectAltName?: { templates: string[] };
                    countryName?: string;
                    organizationName?: string;
                    sanitizeName?: boolean;
                    keys?: {
                        algo: "rsa" | "ecdsa" | "ed25519";
                        size?: 2048 | 4096;
                        curve?: "P-256" | "P-384" | "P-521";
                    };
                },
            >
            | undefined
      • mergePresets: boolean

      Returns void

    • Merge new configuration into existing config using type-safe operations. Uses Zod-inferred types to avoid unsafe casts.

      Parameters

      • newConfig: {
            logging?: {
                level?: "debug" | "info" | "warn" | "error" | "silent";
                showIcons?: boolean;
                showTimestamp?: boolean;
                timestampFormat?: string;
                showPid?: boolean;
                colors?: {
                    debug?: string;
                    info?: string;
                    warn?: string;
                    error?: string;
                    success?: string;
                };
                icons?: {
                    debug?: string;
                    info?: string;
                    warn?: string;
                    error?: string;
                    success?: string;
                };
            };
            ui?: {
                clearOnBanner?: boolean;
                showBanner?: boolean;
                serialFormat?: "hex"
                | "colon";
            };
            limits?: {
                maxCertDownloadBytes?: number;
                tlsConnectTimeoutMs?: number;
                maxChainDepth?: number;
                aiaStopOnRepeatedUrl?: boolean;
            };
            pki?: {
                defaults?: {
                    countryName?: string;
                    stateOrProvinceName?: string;
                    localityName?: string;
                    organizationName?: string;
                    organizationalUnitName?: string;
                    validityDays?: number;
                    preset?: string;
                };
                keys?: | { algo: "rsa"; size: 2048
                | 4096; encoding: "pem" | "der" }
                | {
                    algo: "ecdsa";
                    curve: "P-256" | "P-384" | "P-521";
                    encoding: "pem" | "der";
                }
                | { algo: "ed25519"; encoding: "pem"
                | "der" };
                csr?: {
                    signature?: "sha256" | "sha384" | "sha512";
                    encoding?: "pem" | "der";
                };
                interactive?: boolean;
                sanitizeName?: boolean;
                mergePresets?: boolean;
            };
            storage?: {
                paths?: {
                    output?: string;
                    archive?: string;
                    allowedOutputDirs?: string[];
                };
                filename?: { format?: string; timestampFormat?: string };
                conflict?: {
                    strategy?: "error" | "archive" | "overwrite";
                    archiveFormat?: string;
                };
            };
            presets?: Record<
                string,
                {
                    description: string;
                    organizationalUnitName?: string
                    | string[];
                    validityDays?: number;
                    extensions?: { serverAuth?: boolean; clientAuth?: boolean };
                    variables?: Record<
                        string,
                        {
                            type: "input"
                            | "list";
                            message: string;
                            validate?: string;
                            choices?: string[];
                            default?: string;
                        },
                    >;
                    subjectAltName?: { templates: string[] };
                    countryName?: string;
                    organizationName?: string;
                    sanitizeName?: boolean;
                    keys?: {
                        algo: "rsa" | "ecdsa" | "ed25519";
                        size?: 2048 | 4096;
                        curve?: "P-256" | "P-384" | "P-521";
                    };
                },
            >;
        }

        Validated partial configuration from Zod

      Returns void