Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Copilot Lvl 2
Message 1 of 5

Secret File for Config Settings and/or Environment Variables?

Solved! Go to Solution.

Hello,

 

I have an application that reads a bunch of ENV variables from a file.  Mostly API keys used during integration testing that I don't want in the repo.  I would prefer to not have to set each of these ENV variables as a seperate secret variable.  Is there a way to save a file, say a .env file, as a secret then load that file during the run?  In my case my application will read and set the ENV variables from the file.

 

Something similar to how Jenkins lets you store secret files?

 

https://jenkins.io/doc/book/using/using-credentials/

Thanks.

4 Replies
Highlighted
Copilot Lvl 3
Message 2 of 5

Re: Secret File for Config Settings and/or Environment Variables?

You just need to load your variables into the github virtual environment.  e.g. export in whatever languages/tools of your choices.  e.g. dotenv for javascript or in bash just export $(<.env) inside one of your steps. (as long as they are in the same job they will be in the same environment).

Highlighted
Copilot Lvl 2
Message 3 of 5

Re: Secret File for Config Settings and/or Environment Variables?

Hello @AnthonyWC.   How do I get the file with my environment variables into the virtual environment if it's not in the repository?  The file has API keys that I don't want to add to the repository.  Thank you.

Highlighted
Solution
GitHub Staff
Message 4 of 5

Re: Secret File for Config Settings and/or Environment Variables?

Hi @mrbiggred,

 

We don't have that capability currently.

 

We do have an API coming soon for setting secrets. That could be used for setting large numbers of secrets programmatically.

 

Sorry we don't have an exact solution for you. Hopefully the API makes this workflow possible for you though. 

Highlighted
Copilot Lvl 2
Message 5 of 5

Re: Secret File for Config Settings and/or Environment Variables?

Thank you @SMSCODEVERIFICATION for answing my question even it it was not he answer I wanted to hear.  Also thnk you letting me know about the upcoming API.  All the best.