I want to generate .env file on my remote environment automatically by fetching all environment-specific variables for the repo in github settings and writing them into the file.
Is there an automated way of achieving that?
Thank you for the response @Azeem, this is very helpful. One additional thing though.. Purely theoretically, how would you pass that command (or results of that command) as a parameter to aws-ssm or any other command?
You're welcome! Do you have a concrete example? In general, each CLI argument/flag needs one value to go with it. Depending on what you have in those env vars, their passing to any command may differ. It's not clear whether your question was in conjunction to .env file or not. Could you please clarify this in detail in a new question? This seems like it needs a new question. Thanks!
echo ${{ toJson(env) }}' | jq -r 'keys[] as $k | "\($k)=\(.[$k])"' > .envenvcommand..envfile or not. Could you please clarify this in detail in a new question? This seems like it needs a new question. Thanks!