The environments module provides functions for declaring environment configurations.

Allowed in

  • Top level of repo.ocu.star file only

Usage

Load the module:

load("github.com/ocuroot/sdk/v0/environments.star", "environment")

Example

# Define development environment
environment("dev", 
    attributes={
        "type": "dev",
        "region": "local"
    }
)

# Define staging environment
environment("staging", 
    attributes={
        "type": "staging",
        "region": "us-east-1"
    }
)

# Define production environments
environment("prod-us-east", 
    attributes={
        "type": "prod",
        "region": "us-east-1",
        "tier": "primary"
    }
)

environment("prod-us-west", 
    attributes={
        "type": "prod",
        "region": "us-west-2",
        "tier": "secondary"
    }
)

# Archive an old environment
environment("legacy-prod",
    attributes={"type": "prod"},
    archived=True
)

API Reference

environment(name, attributes=, archived=False)

Declares an environment configuration that will be applied to the Ocuroot organization upon the next deliver or sync operation.

Arguments

  • name: Unique environment name within the parent organization
  • attributes: Dictionary of environment attributes
  • archived: Boolean indicating whether the environment is archived

Returns

  • None

Stubs

def environment(name, attributes = {}, archived = False):
    """
    Declares an environment config. This configuration will be applied to the Ocuroot organization
    upon the next deliver or sync operation.

    Args:
        name: The name of the environment. Must be unique within the parent organization.
        attributes: A dictionary of attributes for the environment.
        archived: A boolean indicating whether the environment is archived.
    """
    pass