Skip to content

Commit 2de4d10

Browse files
authored
Allow environment variables to contain numbers (#1481)
When environment variable pass-through is used, a warning is displayed if the name of the variable contains a number and the value is taken from the host. For example: ``` [cross] warning: got environment variable of "MY_VAR_AES256" which is not a valid environment variable name. the proper syntax is `passthrough = ["ENVVAR=value"]` ``` The variable is still passed onto the cross container with the value from the host, but the warning is misleading.
2 parents 03eea21 + 20c73df commit 2de4d10

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

.changes/1481.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"description": "allow pass-through environment variables to contain numbers",
3+
"type": "fixed"
4+
}

src/docker/shared.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -914,7 +914,7 @@ fn validate_env_var<'a>(
914914
&& !*warned
915915
&& !var
916916
.chars()
917-
.all(|c| matches!(c, 'a'..='z' | 'A'..='Z' | '_' ))
917+
.all(|c| matches!(c, 'a'..='z' | 'A'..='Z' | '_' | '0'..='9'))
918918
{
919919
msg_info.warn(format_args!(
920920
"got {var_type} of \"{var}\" which is not a valid environment variable name. the proper syntax is {var_syntax}"

0 commit comments

Comments
 (0)