Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions e2e/env/test_env_file
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,20 @@ _.file = 'not_present'
EOF
assert "mise env" # does not error

cat <<EOF >mise.toml
[env]
_.file = 'a'
EOF
echo 'export A=1' >a
assert "mise env | grep -v PATH" "export A=1"

cat <<EOF >mise.toml
[env]
_.file = { value = 'b.json' }
EOF
echo '{"B": 2}' >b.json
assert "mise env | grep -v PATH" "export B=2"

cat <<EOF >mise.toml
[env]
_.file = ['a', 'b.json']
Expand All @@ -24,6 +38,26 @@ echo '{"B": 2}' >b.json
assert "mise env | grep -v PATH" "export A=1
export B=2"

cat <<EOF >mise.toml
[env]
_.file = ['a', {path = 'b.json', tools = true}]
EOF
echo 'export A=1' >a
echo '{"B": 2}' >b.json
assert "mise env | grep -v PATH" "export A=1
export B=2"

cat <<EOF >mise.toml
[[env]]
_.file = 'a'
[[env]]
_.file = [{ path = 'b.json', tools = true }]
EOF
echo 'export A=1' >a
echo '{"B": 2}' >b.json
assert "mise env | grep -v PATH" "export A=1
export B=2"

cat <<EOF >mise.toml
[env]
mise.file = ['{{env.HOME}}/.home-test-env']
Expand Down
265 changes: 249 additions & 16 deletions schema/mise-task.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,22 +148,7 @@
"type": "string"
},
"env": {
"additionalProperties": {
"oneOf": [
{
"type": "string"
},
{
"type": "number"
},
{
"enum": [false],
"type": "boolean"
}
]
},
"description": "environment variables",
"type": "object"
"$ref": "#/$defs/env"
},
"tools": {
"description": "tools to install/activate before running this task",
Expand Down Expand Up @@ -330,6 +315,254 @@
"type": "object"
}
]
},
"env": {
"additionalProperties": {
"oneOf": [
{
"type": "object",
"properties": {
"value": {
"oneOf": [
{
"type": "string"
},
{
"type": "number"
},
{
"type": "boolean"
}
]
},
"tools": {
"type": "boolean",
"description": "load tools before resolving"
},
"redact": {
"type": "boolean",
"description": "redact the value from logs"
}
}
},
{
"type": "string"
},
{
"type": "number"
},
{
"type": "boolean"
}
]
},
"description": "environment variables",
"properties": {
"_": {
"description": "environment modules",
"additionalProperties": true,
"properties": {
"file": {
"oneOf": [
{
"type": "object",
"properties": {
"path": {
"oneOf": [
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "string"
}
}
]
},
"tools": {
"type": "boolean",
"description": "load tools before resolving"
},
"redact": {
"type": "boolean",
"description": "redact the value from logs"
}
}
},
{
"description": "dotenv file to load",
"type": "string"
},
{
"description": "dotenv files to load",
"type": "array",
"items": {
"oneOf": [
{
"description": "dotenv file to load",
"type": "string"
},
{
"type": "object",
"properties": {
"path": {
"oneOf": [
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "string"
}
}
]
},
"tools": {
"type": "boolean",
"description": "load tools before resolving"
},
"redact": {
"type": "boolean",
"description": "redact the value from logs"
}
}
}
]
}
}
]
},
"path": {
"oneOf": [
{
"type": "object",
"properties": {
"path": {
"oneOf": [
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "string"
}
}
]
}
}
},
{
"description": "PATH entry to add",
"type": "string"
},
{
"description": "PATH entries to add",
"items": {
"description": "PATH entry to add",
"type": "string"
},
"type": "array"
}
]
},
"python": {
"description": "python environment",
"properties": {
"venv": {
"oneOf": [
{
"description": "path to python virtual environment to use",
"type": "string"
},
{
"description": "virtualenv options",
"properties": {
"create": {
"default": false,
"description": "create a new virtual environment if one does not exist",
"type": "boolean"
},
"path": {
"description": "path to python virtual environment to use",
"type": "string"
},
"python": {
"description": "python version to use",
"type": "string"
},
"python_create_args": {
"description": "additional arguments to pass to python when creating a virtual environment",
"type": "array",
"items": {
"type": "string"
}
},
"uv_create_args": {
"description": "additional arguments to pass to uv when creating a virtual environment",
"type": "array",
"items": {
"type": "string"
}
}
},
"required": ["path"],
"type": "object"
}
]
}
},
"type": "object"
},
"source": {
"oneOf": [
{
"type": "object",
"properties": {
"path": {
"oneOf": [
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "string"
}
}
]
},
"tools": {
"type": "boolean",
"description": "load tools before resolving"
},
"redact": {
"type": "boolean",
"description": "redact the value from logs"
}
}
},
{
"description": "bash script to load",
"type": "string"
},
{
"description": "bash scripts to load",
"items": {
"description": "bash script to load",
"type": "string"
},
"type": "array"
}
]
}
},
"type": "object"
}
},
"type": "object"
}
},
"description": "Config file for included mise tasks (https://mise.jdx.dev/tasks/#task-configuration)",
Expand Down
55 changes: 35 additions & 20 deletions schema/mise.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,41 @@
},
{
"description": "dotenv files to load",
"type": "array",
"items": {
"description": "dotenv file to load",
"type": "string"
},
"type": "array"
"oneOf": [
{
"description": "dotenv file to load",
"type": "string"
},
{
"type": "object",
"properties": {
"path": {
"oneOf": [
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "string"
}
}
]
},
"tools": {
"type": "boolean",
"description": "load tools before resolving"
},
"redact": {
"type": "boolean",
"description": "redact the value from logs"
}
}
}
]
}
}
]
},
Expand Down Expand Up @@ -1133,22 +1163,7 @@
"type": "string"
},
"env": {
"additionalProperties": {
"oneOf": [
{
"type": "string"
},
{
"type": "number"
},
{
"enum": [false],
"type": "boolean"
}
]
},
"description": "environment variables",
"type": "object"
"$ref": "#/$defs/env"
},
"tools": {
"description": "tools to install/activate before running this task",
Expand Down
Loading
Loading