DEV Community

Discussion on: How to securely store API keys

Collapse
 
metcoder profile image
Carlos Fuentes

What about ignoring the .env file or any file you use to save your keys and secrets with .gitignore?

Collapse
 
willemw profile image
Willem Wollebrants

This is how I* do it: .env is ignored, and there's an .env.example included in the repository so that a developer knows which keys are expected/needed/available.

  • not just me, of course. Laravel for example has the same thing
Collapse
 
courier10pt profile image
Bob van Hoove

It's what we currently do at work. The secret files are in a KeePass database. It's cumbersome to deal with, especially when you want to checkout a fresh version of a project. Even with a script that copies the files to the projects that should contain them.

Ofcourse this has to do with KeePass as our solution for storing the .gitignored files.

I'm glad the author made the effort of listing some alternatives ways to protect files, and others responded with even more ways to do it. Because at some point I'll be fed up with that KeepAss database and this article is where I'll refer back to :)

Collapse
 
alanguir profile image
Alan Languirand

Environment variables are by far the simplest way to go. There’s a bit of initial coordination when multiple developers need the same keys - anyone have a favorite way to do initial setup?