Skip to content

Commit 26c2e7a

Browse files
committed
fix: remove special treatment
1 parent 6763cbc commit 26c2e7a

File tree

2 files changed

+6
-41
lines changed

2 files changed

+6
-41
lines changed

generate-yaml-rp-env.sh

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -32,42 +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-
# Validate and format CIS credential JSON
38-
if ! echo "$env_value" | jq empty 2>/dev/null; then
39-
echo "Error: $var_name contains invalid JSON"
40-
exit 1
41-
fi
42-
43-
# Compact JSON and properly escape for YAML
44-
clean_value=$(echo "$env_value" | jq -c .)
45-
# Escape quotes and backslashes for YAML
46-
clean_value="${clean_value//\\/\\\\}"
47-
clean_value="${clean_value//\"/\\\"}"
48-
49-
# For multiline YAML strings, use the literal scalar style
50-
if [[ "$line" =~ ^[[:space:]]*[^:]+:[[:space:]]*INJECT_ENV\. ]]; then
51-
# This is a YAML value, use proper quoting
52-
line="${line//INJECT_ENV.${var_name}/\"${clean_value}\"}"
53-
else
54-
line="${line//INJECT_ENV.${var_name}/${clean_value}}"
55-
fi
56-
elif [[ "$env_value" =~ ^\s*[\{\[] ]] || [[ "$env_value" =~ [\}\]]\s*$ ]]; then
57-
# This looks like JSON, validate and compact it
58-
if echo "$env_value" | jq empty 2>/dev/null; then
59-
clean_value=$(echo "$env_value" | tr -d '\000-\037' | jq -c .)
60-
line="${line//INJECT_ENV.${var_name}/\"${clean_value}\"}"
61-
else
62-
echo "Warning: $var_name appears to be JSON but is invalid. Using as-is."
63-
clean_value="${env_value//\"/\\\"}"
64-
line="${line//INJECT_ENV.${var_name}/\"${clean_value}\"}"
65-
fi
66-
else
67-
# For non-JSON content, escape quotes and use as-is
68-
clean_value="${env_value//\"/\\\"}"
69-
line="${line//INJECT_ENV.${var_name}/\"${clean_value}\"}"
70-
fi
35+
line="${line//INJECT_ENV.${var_name}/${env_value}}"
7136
else
7237
echo "Warning: Environment variable $var_name is not set or empty. Leaving placeholder unchanged."
7338
fi

providers/provider-btp/v1.0.3/setup/config.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ type: Opaque
77
stringData:
88
credentials: |
99
{
10-
"email": INJECT_ENV.TECHNICAL_USER_EMAIL,
11-
"username": INJECT_ENV.TECHNICAL_USER_EMAIL,
12-
"password": INJECT_ENV.TECHNICAL_USER_PASSWORD
10+
"email": "INJECT_ENV.TECHNICAL_USER_EMAIL",
11+
"username": "INJECT_ENV.TECHNICAL_USER_EMAIL",
12+
"password": "INJECT_ENV.TECHNICAL_USER_PASSWORD"
1313
}
1414
---
1515
apiVersion: v1
@@ -27,8 +27,8 @@ kind: ProviderConfig
2727
metadata:
2828
name: account-provider-config
2929
spec:
30-
globalAccount: INJECT_ENV.GLOBAL_ACCOUNT
31-
cliServerUrl: INJECT_ENV.CLI_SERVER_URL
30+
globalAccount: "INJECT_ENV.GLOBAL_ACCOUNT"
31+
cliServerUrl: "INJECT_ENV.CLI_SERVER_URL"
3232
cisCredentials:
3333
secretRef:
3434
name: cis-provider-secret

0 commit comments

Comments
 (0)