v0.3.2

Documentation version

v0.2.4v0.3.2
en

Documentation language

en

Search documentation

ESC

Documentation search

What are you working on?

Find a guide, configuration option, action, or ESH topic.

Browse documentation
DocsEnvironment configuration

Environment configuration

.evin/environment.json declares variable types, required constraints, patterns, defaults, injection scopes, stage filters, and secret handling. It does not configure named runtime environments; there is no evin run --env option.

The manifest is standard JSON. Its required $schema property points to https://dl.everyinit.dev/schema/v1/environment. Editors can use this URI for JSON Schema validation and completion. Evin bundles the matching schema and performs runtime structural and semantic validation without fetching it from the network.

Schema contracts are versioned independently of Evin releases. Compatible additions remain under /v1/; incompatible shape changes receive a new versioned URI. The checked-in schema is generated from the Rust model. Regenerate it with cargo run --locked -p evin-config --example export_schemas and verify it with cargo evin-dev run schema-check.

Root schema

environment Define environment variable schemas, presets, and injection scopes.

The root object accepts the required $schema property, optional presets, and optional environments. Presets map names to lists of variable names; environment definitions map variable names to typed declarations.

environment.$schema Select the versioned JSON Schema contract for this environment document.

Use the published URI as the $schema value. Evin bundles the schema for offline runtime validation.

environment.presets Define reusable groups of environment variable names.

Built-in preset names include rust, node, ci, python, aws, and docker. Custom presets can define additional groups or override built-in names. Tasks select presets through their .flow configuration:

tasks:
  test:
    stage: Test
    presets: [rust, ci]
    run: cargo test
environment.environments Define variable types, validation, defaults, and runtime handling.

Each environment entry supports type (string, number, boolean, or secret), required, pattern, description, scalar default, scopes, and stages. Process variables are injected into child processes; Internal variables remain available to Evin's template and pipeline logic. Stage names match case-insensitively. A missing scopes value defaults to both scopes, and an omitted stages value allows all stages.

Example

{
  "$schema": "https://dl.everyinit.dev/schema/v1/environment",
  "presets": {
    "web": ["LOG_LEVEL", "PORT", "DATABASE_URL"]
  },
  "environments": {
    "LOG_LEVEL": {
      "type": "string",
      "default": "info",
      "description": "Application log level"
    },
    "PORT": {
      "type": "number",
      "default": 8080,
      "pattern": "^[0-9]+$",
      "scopes": ["Internal", "Process"]
    },
    "DATABASE_URL": {
      "type": "secret",
      "required": true,
      "scopes": ["Process"]
    }
  }
}

Value sources and precedence

Evin resolves a global variable pool from the root .env file, workspace values, schema defaults, and the host environment allowlist. Module values overlay workspace values. A task then selects from the pool.

With neither env nor presets, a task receives the complete pool plus the default host safelist (PATH, HOME, USER, SHELL, and TERM):

tasks:
  test:
    stage: Test
    run: cargo test

A list selects named keys from the pool:

env: [LOG_LEVEL, DATABASE_URL]

A map declares task-level values:

env:
  LOG_LEVEL: trace
  CI: "true"

When presets is present without env, the task receives the selected preset keys rather than the complete pool. pure: true removes the default host safelist. Stage and scope filtering applies after task selection.

Variables with type: secret are registered with Evin's output redactor when they resolve. Known secret values of at least four characters are replaced with *** in captured task output. Redaction does not make it safe to print credentials; avoid putting secrets in command arguments and logs.

Migrating from 0.2.x

Rename .evin/environment.flow to .evin/environment.json, convert the document to JSON, remove the #!evin/v1 header and root version, and add "$schema": "https://dl.everyinit.dev/schema/v1/environment". Evin 0.3.0 does not load the old Flow file or provide an automatic migration command.

Page source: reference/40.environment-configuration.4520.md