Skip to content

Commit

Permalink
Fix - recaptcha issue while applying job
Browse files Browse the repository at this point in the history
  • Loading branch information
cp-dharti-r committed Apr 24, 2024
1 parent 4202f58 commit 62935ca
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/deploy-backend-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/deploy-backend-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion utils/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 62935ca

Please sign in to comment.