|
6 | 6 | import re
|
7 | 7 |
|
8 | 8 | from java.lang import Boolean
|
| 9 | +from java.lang import System |
9 | 10 | from java.io import BufferedReader
|
10 | 11 | from java.io import File
|
11 | 12 | from java.io import FileOutputStream
|
@@ -276,13 +277,23 @@ def _substitute(text, variables, model_context, error_info, attribute_name=None)
|
276 | 277 | # check environment variables before @@FILE:/dir/@@ENV:name@@.txt@@
|
277 | 278 | matches = _environment_pattern.findall(text)
|
278 | 279 | for token, key in matches:
|
279 |
| - if str_helper.to_string(key) not in os.environ: |
| 280 | + # |
| 281 | + # On Windows, environment variables are not case sensitive. On Windows 11 anyway, |
| 282 | + # setting an environment variable using a name with lower-case letters will always |
| 283 | + # result in an environment variable name in all upper-case. |
| 284 | + # |
| 285 | + env_var_name = str_helper.to_string(key) |
| 286 | + is_windows = System.getProperty('os.name').startswith('Windows') |
| 287 | + if is_windows and env_var_name not in os.environ and env_var_name.upper() in os.environ: |
| 288 | + env_var_name = env_var_name.upper() |
| 289 | + |
| 290 | + if env_var_name not in os.environ: |
280 | 291 | allow_unresolved = validation_config.allow_unresolved_environment_tokens()
|
281 | 292 | _report_token_issue('WLSDPLY-01737', method_name, allow_unresolved, key)
|
282 | 293 | _increment_error_count(error_info, allow_unresolved)
|
283 | 294 | problem_found = True
|
284 | 295 | continue
|
285 |
| - value = os.environ.get(str_helper.to_string(key)) |
| 296 | + value = os.environ.get(env_var_name) |
286 | 297 | text = text.replace(token, value)
|
287 | 298 |
|
288 | 299 | # check secret variables before @@FILE:/dir/@@SECRET:name:key@@.txt@@
|
|
0 commit comments