DocumentationLearnEncryptingEncrypted Files

Encrypted Files

Understand the encrypted .env file format.

Once encrypted, the .env file is safe, and recommended, to commit to code.

# .env
DOTENV_PUBLIC_KEY="0312770354c6661d9902a3a9e648b4599f71a8c365c132421b94e21fefcc7d9457"
HELLO="encrypted:BBLDHBFNnbfWt2A3PS8fzjEaLlZNB695T527ZrbF707xIv/OTmhnnxIr2bF07kr3npmgmrIcYm3dB/DOsKrptHLne06UlZpRh2AYNN/ITwdLGIom3HIZpOgc4cxs/jIXfsdgEghs"

Format

  • KEY names are preserved.
  • encrypted: values are ciphertext.
  • Plaintext values can be safely mixed in when a value is not sensitive.
  • DOTENV_PUBLIC_KEY holds the public key used to encrypt values.

The public key can live in source control because it can only encrypt values. It cannot decrypt them.