#!/bin/bash

echo retriving the key
val=$(aws ssm get-parameter --name "/$ENVIRONMENT/common/CONSUL_ENCRYPTION_KEY" --with-decryption --output json | jq -r '.Parameter.Value' || true)
echo got the key

# file_path="qa-$ENVIRONMENT/$SERVICE_TYPE/$AWS_REGION/saferx-backend/task.json    ### the sed is hapening right before the apply 
# sed -i 's/"-encrypt=VALUE_TO_REPLACE"/"-encrypt='"$val"'"/' $file_path
# echo "file_path=$file_path" >> $GITHUB_ENV

echo "val=$val" >> $GITHUB_ENV