diff --git a/.github/workflows/deploy-backend-dev.yml b/.github/workflows/deploy-backend-dev.yml index 465fa4d30..9f46526fd 100644 --- a/.github/workflows/deploy-backend-dev.yml +++ b/.github/workflows/deploy-backend-dev.yml @@ -26,9 +26,11 @@ jobs: aws-region: ap-south-1 - name: Build backend and copy zip to S3 + env: + RECAPTCHA_CONFIG_JSON_BASE64: ${{ secrets.RECAPTCHA_CONFIG_JSON_BASE64 }} run: | - secret_value="${{ secrets.RECAPTCHA_CONFIG_JSON_BASE64 }}" - awk -v val="${secret_value}" '{gsub(/{{RECAPTCHA_CONFIG_JSON_BASE64}}/, val)} 1' utils/helper.go > recatpcha_config_key.go && mv recatpcha_config_key.go utils/helper.go + escaped_value=$(printf '%s' "$RECAPTCHA_CONFIG_JSON_BASE64" | tr -d '\n') + awk -v pattern="RECAPTCHA_CONFIG_JSON_BASE64" -v replacement="$escaped_value" '{gsub(pattern, replacement)} 1' utils/helper.go > recatpcha_config_key && mv recatpcha_config_key utils/helper.go apt-get update && apt-get install -y zip GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o main main.go zip canopas_serverless_dev_${{ github.sha }}.zip main diff --git a/.github/workflows/deploy-backend-prod.yml b/.github/workflows/deploy-backend-prod.yml index d38cd8400..e6da70be5 100644 --- a/.github/workflows/deploy-backend-prod.yml +++ b/.github/workflows/deploy-backend-prod.yml @@ -26,9 +26,11 @@ jobs: aws-region: ap-south-1 - name: Build backend and copy zip to S3 + env: + RECAPTCHA_CONFIG_JSON_BASE64: ${{ secrets.RECAPTCHA_CONFIG_JSON_BASE64 }} run: | - secret_value="${{ secrets.RECAPTCHA_CONFIG_JSON_BASE64 }}" - awk -v val="${secret_value}" '{gsub(/{{RECAPTCHA_CONFIG_JSON_BASE64}}/, val)} 1' utils/helper.go > recatpcha_config_key.go && mv recatpcha_config_key.go utils/helper.go + escaped_value=$(printf '%s' "$RECAPTCHA_CONFIG_JSON_BASE64" | tr -d '\n') + awk -v pattern="RECAPTCHA_CONFIG_JSON_BASE64" -v replacement="$escaped_value" '{gsub(pattern, replacement)} 1' utils/helper.go > recatpcha_config_key && mv recatpcha_config_key utils/helper.go apt-get update && apt-get install -y zip GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o main main.go zip canopas_serverless_prod_${{ github.sha }}.zip main diff --git a/utils/helper.go b/utils/helper.go index 0e9743c66..a5fc4beab 100755 --- a/utils/helper.go +++ b/utils/helper.go @@ -59,7 +59,7 @@ func (repo *utilsRepository) VerifyRecaptcha(token string) (bool, error) { credBytes, err := b64.StdEncoding.DecodeString(recaptchaBase64) if err != nil { - log.Error(err) + log.Error("Error while decoding recaptcha: ", err) return false, err }