Yevai NPM Packages
    Preparing search index...

    Class CloudConfigV2

    Typed access to Pulumi ESC configuration and secrets within SST applications.

    Unlike the original CloudConfig, this version directly queries Pulumi Environments using the CLI, ensuring access to the most up-to-date configuration values, and caches them per environment to minimize CLI execution overhead.

    const config = new CloudConfigV2();

    // Optional values
    const logLevel = config.get("logLevel") ?? "info";

    // Required values (throws if missing)
    const apiKey = config.require("apiKey");

    // Typed values
    const port = config.requireNumber("port");
    const debug = config.getBoolean("debug") ?? false;
    const settings = config.requireObject<Settings>("settings");
    Index
    • Resolves the target ESC environment from the ambient PULUMI_* env vars and loads (or reuses) its configuration values.

      Returns CloudConfigV2

      If the organization, stage, or project cannot be determined, or if PULUMI_WORK_DIR is unset outside of tests.

    organization: string
    project: string
    stage: string
    • Get a config value as a string, or undefined when missing.

      Parameters

      • key: string

      Returns string | undefined

    • Get a config value as a boolean (the string "true" is truthy), or undefined when missing.

      Parameters

      • key: string

      Returns boolean | undefined

    • Get a config value as a number, or undefined when missing or not numeric.

      Parameters

      • key: string

      Returns number | undefined

    • Get a config value as a structured object, parsing JSON strings when needed.

      Type Parameters

      • T

        The expected shape of the value.

      Parameters

      • key: string

      Returns T | undefined

      The value typed as T, or undefined when missing or unparsable.

    • Get a required config value as a string.

      Parameters

      • key: string

      Returns string

      If the key is missing.

    • Get a required config value as a boolean.

      Parameters

      • key: string

      Returns boolean

      If the key is missing.

    • Get a required config value as a number.

      Parameters

      • key: string

      Returns number

      If the key is missing or not numeric.

    • Get a required config value as a structured object.

      Type Parameters

      • T

        The expected shape of the value.

      Parameters

      • key: string

      Returns T

      If the key is missing or unparsable.