I am developing a shell script that will replace logglyKey from environment.ts file.
// environment.ts
{
production: true,
logglyKey: 'asdfasfd-asdfsd-asdfs-asdfsdf-asdfasfd'
}
I want to replace logglyKey on build process from environment variables from bitbucket pipelines. How can I achieve this?
I tried this, but it doesn't extract the logglyKey correctly.
// addLogglyKey.sh
#!/bin/bash
export LOGGLY_KEY=$(grep -oP "'logglyKey'\s*:\s*'([A-Za-z0-9-])'" ./src/environments/environment.ts)
echo "Previous logglyKey was : ${LOGGLY_KEY}"
But this prints empty logglyKey.
Previous logglyKey was :