File tree Expand file tree Collapse file tree 1 file changed +0
-17
lines changed Expand file tree Collapse file tree 1 file changed +0
-17
lines changed Original file line number Diff line number Diff line change @@ -32,24 +32,7 @@ process_file() {
3232 env_value=" ${! var_name} "
3333
3434 if [[ -n " $env_value " ]]; then
35- # Special handling for CIS_CREDENTIAL or similar JSON structures
36- if [[ " $var_name " == " CIS_CREDENTIAL" ]] || [[ " $var_name " == " CIS_CENTRAL_BINDING" ]]; then
37- # First escape any literal newlines and other control characters for proper JSON parsing
38- escaped_json=$( printf ' %s' " $env_value " | sed ' :a;N;$!ba;s/\n/\\n/g' | sed ' s/\r/\\r/g' | sed ' s/\t/\\t/g' )
39-
40- # Validate the escaped JSON
41- if ! echo " $escaped_json " | jq empty 2> /dev/null; then
42- echo " Error: $var_name contains invalid JSON"
43- exit 1
44- fi
45-
46- # Process with jq and then clean up the escaped newlines
47- clean_value=$( echo " $escaped_json " | jq -c . | sed ' s/\\n//g' )
48- line=" ${line// INJECT_ENV.${var_name} / ${clean_value} } "
49- else
50- # For non-JSON variables, use direct substitution
5135 line=" ${line// INJECT_ENV.${var_name} / ${env_value} } "
52- fi
5336 else
5437 echo " Warning: Environment variable $var_name is not set or empty. Leaving placeholder unchanged."
5538 fi
You can’t perform that action at this time.
0 commit comments