Class EnvironmentRegistry<Env>

Registry for managing multiple environments with their resolutions.

This class provides a fluent API for building environment configurations. Each environment can have multiple resolution methods (hardcoded, from-env, etc.) and the registry ensures type safety across all environments.

const envReg = createEnvironmentRegistry()
.addEnv("local", defineType<{ env: Record<string, string> }>(), (env) => env
.addResolution("hardcoded", defineType<string>(), (data) => data.payload)
.addResolution("from-env", defineType<undefined>(), (data) =>
data.envData.env[data.variableName]))

Type Parameters

Properties

environments: Env[]

Array of environment configurations

Methods

  • Creates a VariableRegistry that can define variables for this environment registry.

    The VariableRegistry will have full type safety for all environments and resolutions defined in this registry.

    Returns VariableRegistry<EnvironmentRegistry<Env>, never>

    A new VariableRegistry configured for this environment registry

    const varReg = envReg.createVariableRegistry()
    .addVar("DATABASE_URL", (v) => v
    .for("local", "from-env")
    .for("workflows", "from-github-secrets"))