How to move a key from code to a Secret Environment Variable

Hi folks,

I’m testing an app that fetches meta-data from a Shoutcast stream,
It also sends the audio from the Shoutcast stream to a YouTube live stream.

Everything works, but the YouTube key is stored in the live.sh file, which is not secure.
How do you move the key from the code to a Secret Environment Variable?
Do you need to change the code also?

Example: rtmp://a.rtmp.youtube.com/live2/streamkey

ffmpeg -stream_loop -1 -re -i deck.mp4 -stream_loop -1 -re -i http://2.00.144.74:8211/ -vcodec libx264 -pix_fmt yuvj420p -maxrate 20048k -preset veryfast -r 12 -framerate 30 -g 50 -c:a aac -b:a 128k -ar 44100 -strict experimental -video_track_timescale 1000 -b:v 150000k -f flv rtmp://a.rtmp.youtube.com/live2/streamkey

Thanks in advance

Hey EMar,
We tried to answer you question in Replit 101 Coding Helpline just now, the video is at Replit 101 Coding Helpline - YouTube

2 Likes