openqa
openqa copied to clipboard
feat: integrate varlock for environment variable schema + validation
Overview
Replace bare dotenv with varlock in all scaffolded .openqa projects to add:
.env.schema— committed to git; documents every variable (name, description, type, default). AI agents can read the schema without seeing actual secret values.- Validation on load — clear errors if a required variable is missing or has the wrong type
- Secret scanning / log leak detection at runtime
- Multiple environment precedence (
.env,.env.local,.env.[env])
Changes
- Add
varlockto all framework deps ininit.js— auto-installed with zero manual steps - Add
.env.schematemplate to each framework (playwright-bdd, cucumber, playwright-yaml) - Wrap npm scripts with
varlock run --so vars are pre-injected before Playwright/Cucumber starts - Remove
import 'dotenv/config'fromplaywright.configfiles (varlock run makes it redundant) - Update template
package.jsonfiles withengines: { node: ">=22" }(varlock requirement)
Approach
Use varlock run -- <command> in npm scripts rather than import 'varlock/auto-load' — this avoids a Node.js v22 constraint on the openqa core library itself while still providing full varlock features in the scaffolded project.
No change to src/index.js — openqa core keeps dotenv for its own env loading.