-
Notifications
You must be signed in to change notification settings - Fork 0
Environment Variables
Beez can load environment variables from files and config, expose them to build.lua, and include selected vars in cache fingerprints.
local buildType = beez.env("BUILD_TYPE")Resolution order for beez.env(key):
- Process environment (
getenv), including values fromenv.varsand env files loaded byapplyEnvironment() - Project root
.envfile (lazy file read on firstbeez.env()call) -
nilif unset
Keys from env.files (for example .env.local) are available through beez.env() only after beez.config() has applied them to the process. Load project config before reading those vars in build.lua.
env = {
load_dotenv = true,
dotenv_overrides_system = false,
files = ".env",
vars = {
BUILD_TYPE = "Release",
},
hash_vars = {
"CC",
"CXX",
"CFLAGS",
"CXXFLAGS",
"LDFLAGS",
"BUILD_TYPE",
},
ignore_vars_for_hashing = {
"TERM",
"PWD",
},
mask_secrets = {
"GITHUB_TOKEN",
},
}When true (default if you do not set it), Beez also loads .env from the project root in addition to any env.files entries.
Extra env files to load. A single string or a list of paths:
files = ".env.local"
-- or
files = { ".env", ".env.local" }Paths are relative to the project root unless absolute.
| Value | Behavior |
|---|---|
false (default) |
Do not overwrite vars already set in the shell |
true |
Values from dotenv files replace existing process env |
env.vars from config always overrides the process environment when applied.
Default values set for the Beez process. Useful for toolchain or output paths shared by the whole team:
vars = {
CC = "clang",
CXX = "clang++",
BUILD_TYPE = "Release",
}Variables listed in hash_vars are included in the environment fingerprint for cache keys. If a hashed var changes, Beez treats cached step results as stale.
Default hash_vars when you omit the key:
-
CC,CXX,CFLAGS,CXXFLAGS,LDFLAGS,BUILD_TYPE
Vars in ignore_vars_for_hashing are skipped even if they appear in hash_vars. Defaults include TERM, COLORTERM, PWD, SESSION_ID.
Add compiler flags or custom toolchain vars to hash_vars when they affect build output. Add noisy session vars to ignore_vars_for_hashing.
See Cache Keys and Invalidation for how fingerprints affect step cache and success cache.
Keys listed in mask_secrets are redacted in log output. Defaults include common token names (GITHUB_TOKEN, AWS_SECRET_ACCESS_KEY, etc.).
Add any secret your steps or workers might print.
.env (gitignored, local secrets and overrides):
BUILD_TYPE=Debug
API_TOKEN=...
config.lua (committed, team defaults):
env = {
load_dotenv = true,
vars = {
BUILD_TYPE = "Release",
},
hash_vars = {
"CC", "CXX", "BUILD_TYPE",
},
}build.lua:
beez.config(require("config"))
local buildType = beez.env("BUILD_TYPE") or "Release"Shell steps run with the environment Beez applied. They do not automatically re-source .env; Beez has already loaded it into the process.
If you run beez from CI, set vars in the CI environment or commit safe defaults in config.lua.
-
Project Config - where
envfits in project settings - Cache Settings - cache path and compression
- Configuration Overview - merge order
Quick Reference · Glossary · FAQ
- Fundamentals
- Core Concepts
- Project Layout
- First Pipeline
- Phases and Scopes
- How Phases and Scopes Work
- Selecting with Phases and Scopes
- Designing Phases and Scopes
- Parallel Execution and Dependencies
- Configuration
- Configuration Overview
- Global User Config
- Project Config
- Environment Variables
- Performance Settings
- Cache Settings
- Config Reference
- CLI
- CLI Overview
- Running Targets
- Filtering by Phase
- Running a Single Step
- Listing Entities
- Output and Logging Flags
- Cache and Maintenance Flags
- Meta and Utility Commands
-
Project Scaffolding —
beez --init(embedded Tempify) - CLI Flag Reference
- Lua DSL
- DSL Overview
- Plugin System — Plugins, Config DSL, Standard-Workflows
- Step Declaration
- Task Declaration
- Workflow Declaration
- Order Declaration
- Configure Step
- ReqPack Declaration
- Beez API
- Step Context
- DSL Patterns
- Caching
- Caching Overview
- Step Cache
- Success Cache
- Glob Metadata Cache
- Artifact Patterns
- Cache Keys and Invalidation
- Cache Storage and Maintenance
- Caching Troubleshooting
- UI and Output
- Output Modes
- Progress and Animation
- Colors and Themes
- Run Summaries
- Logging and Log Files
- Development and Contribution
- Building and Setup
- Repository Layout
- Testing
- Code Quality
- Feature Development Workflow
- Submitting Changes