substituteVars
Recursively substitute ${VAR|default} environment-variable references in any
value. Walks strings, objects, and arrays. After substitution, resulting
strings are coerced to:
true/falsewhen they equal"true"/"false"(case-insensitive)- an integer when they match
/^\d+$/ - a float when they match
/^\d+\.\d+$/ - otherwise left as a string
For raw string interpolation without type coercion, use
interpolateEnvVars() instead.
Parameters
value
The value to process. Can be a string, object, array, or primitive.
maxDepth
Maximum recursion depth. Throws Error("Maximum variable substitution depth exceeded") when the limit is reached.
Returns
The input value with all environment variables substituted. Type depends on the input and the coercion rules above.