Skip to content

env: resolve env vars in order#1519

Merged
jdx merged 3 commits intomainfrom
env-man
Jan 26, 2024
Merged

env: resolve env vars in order#1519
jdx merged 3 commits intomainfrom
env-man

Conversation

@jdx
Copy link
Copy Markdown
Owner

@jdx jdx commented Jan 24, 2024

This is a major refactor of how env vars are handled. Previously, they were resolved as part of parsing but they really need to be done one at a time so that the results of each var can be used for the next one. This should also make it possible to greatly simplify how env vars are handled in tools by using the same logic.

Fixes #1262
Prereq for #1447
Prereq for #1303
Prereq for #1261

@jdx jdx force-pushed the env-man branch 3 times, most recently from 7fc3b23 to 871abf9 Compare January 25, 2024 00:48
@jdx jdx changed the title env-man env: resolve env vars in order Jan 25, 2024
@jdx
Copy link
Copy Markdown
Owner Author

jdx commented Jan 25, 2024

@Ajpantuso wanted to draw your attention to this PR just so you're aware of it since I know you worked on some of the env stuff a bit. I'd hold off on any env-related things for a couple of days until I can get this out since all of that logic is going to change.

@jdx jdx force-pushed the env-man branch 12 times, most recently from 3165305 to 44cab31 Compare January 26, 2024 20:01
@jdx jdx marked this pull request as ready for review January 26, 2024 22:46
@jdx jdx enabled auto-merge (squash) January 26, 2024 22:50
@jdx jdx merged commit 7dce359 into main Jan 26, 2024
@jdx jdx deleted the env-man branch January 26, 2024 22:52
jdx pushed a commit that referenced this pull request Apr 11, 2026
## Summary
- add missing task sandbox fields to the mise task schemas
- add top-level `env_file`/`dotenv`/`env_path` schema entries and mark
them deprecated as legacy shortcuts
- allow env age directive options, tighten complex age option nesting,
and cover the schema fixture
- keep sandbox fields in a task-only schema overlay so they validate for
`[tasks.*]` but do not leak into `[task_templates.*]`, whose Rust type
does not deserialize/apply them

## Context
- The renderer builds both task and `task_template` schemas from
`task_props`. The new `taskOnlyProps` overlay is for fields accepted by
`Task` but not `TaskTemplate`; this mirrors the existing task-only
treatment for `extends`.
- `env_file`, `dotenv`, and `env_path` are still accepted by current
serde parsing, but they are legacy top-level shortcuts.
#1361 marked `env_file`/`env_path`
deprecated in favor of `env.mise.file`/`env.mise.path`;
#1519 later rewrote env parsing and kept
accepting `env_file`, alias `dotenv`, and `env_path` without a runtime
deprecation warning. The schema keeps them valid but marks them
deprecated to point users at `[env] _.file` / `_.path`.
- Task sandbox config fields were introduced with process sandboxing in
#8845; `allow_env` wildcard semantics
were later expanded in #8974.
- Age env directives, including flattened `EnvDirectiveOptions` on age
values, were introduced in #6463. This
PR now mirrors the Rust variants more closely: top-level age options are
allowed with `age = "..."`, while complex `age = { value = ... }`
options must be nested inside the `age` object.

## Verification
- `bun xtasks/render/schema.ts`
- `jq empty schema/mise.json schema/mise-task.json schema/miserc.json`
- `git diff --check`
- `mise run test:e2e e2e/config/test_schema_tombi`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow env variables to reference previously defined env vars in same configuration file

2 participants