0

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?

6
  • 1
    Relevant: stackoverflow.com/questions/75691648/… Commented Jun 29, 2023 at 5:14
  • 1
    Example: echo ${{ toJson(env) }}' | jq -r 'keys[] as $k | "\($k)=\(.[$k])"' > .env Commented Jun 29, 2023 at 5:15
  • If you're using a Linux runner, you can also take a look at the env command. Commented Jun 29, 2023 at 5:17
  • 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? Commented Jun 30, 2023 at 14:37
  • 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! Commented Jun 30, 2023 at 16:02

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.