Store .env parameters as secret

Answered

I have python project which uses .env file as storage for env variables.

The .env file is not committed to git and I fill it manually on my local environment.

I want to set up my project in the TeamCity and try to understand it is such a possibility to store such file in the TeamCity project and use these .env parameters?

I knew that I can add environment variables to the project one by one but I want to add them as one file from some secret storage or smth.

Is it possible?

3 comments
Comment actions Permalink

Hi Algot,

You cannot store a file as a parameter per se, but you can store the file contents as a text parameter. Text parameters are not limited to a single line. But I suppose it's better to use env. build configuration parameters - this approach seems easier to maintain. Moreover, you can use the 'password' type parameter specification to hide its actual values in the UI and build logs.

You can also integrate with HashiCorp Vault via this plugin unless this is an overkill for your task.

1
Comment actions Permalink

Mikhail Efremov

Hello

>>But I suppose it's better to use env. build configuration parameters - this approach seems easier to maintain
Am I understand correctly that I only could add such variables one-by-one via web interface only?
Or there is a possibility to specify them in some configuration file?

0
Comment actions Permalink

If you use versioned settings, you can define all the parameters via Kotlin DSL (or XML, if you prefer this format). If you want the values of these variables to be secure, you can use Secure Tokens.

0

Please sign in to leave a comment.