Back to browse
GitHub Repository

Encrypted, Merged Environment

6 starsPython

Emergenv: Compose+compute env files from SSH-encrypted fragments in Git

by anoyomoose·Jun 11, 2026·1 point·0 comments

AI Analysis

●●SolidBig BrainNiche Gem

SSH-key encrypted env fragments with DRY composition for bare-metal git deploys.

Strengths
  • Uses existing SSH host keys for decryption—no separate KMS or Vault needed.
  • Fragment merging with @include and per-key imports enables DRY composition.
  • Variable substitution and integer arithmetic at build time without shell invocation.
Weaknesses
  • Narrow audience: only useful for bare-metal/VPS workflows, not cloud platforms.
  • Requires age binary installed on deployment targets.
Category
Target Audience

DevOps engineers deploying to dedicated servers and VPS

Similar To

git-crypt · sops · Doppler

Post Description

Annoyed with the mess of .env files I have for various git-based deployments, and the copy/paste extravaganza my docker-compose environment sections have turned into, I decided to create something to solve that for my specific use-case.

EMERGENV creates plaintext env files from encrypted fragments using whole-fragment includes and per-key imports, and supports multiple layers of extensions and overrides, bringing DRY and easy composability to env files. Fear not though: all this functionality is there when you need it, but you can also 'just' encrypt your .env files :)

All secrets live in the fragments, which are encrypted with 'age' using SSH keys - just add everybody who needs to decrypt to the authorized_keys file. The encrypted fragments can be committed to git without issue. Simply 'build' the target file on deploy to produce the plaintext.

Extensive shell-like variable substitutions and integer arithmetic are also supported, without invoking a shell, and without execution capability.

There are undoubtedly other solutions that do similar things, but:

- I originally wanted to extend 'sops', but you can't trust sops to give you back the exact same plaintext (for env files specifically) without jumping through hoops you'll eventually forget about and lose data. EMERGENV verifies every encryption decrypts back to the original plaintext before writing.

- Other solutions I looked at all assume big infra, cloud, key vaults, I wanted something for the git-based deployments I'm actually using without adding a lot on top.

- I just wanted exactly these features, no more and no less :)

Perfect for people who need exactly this!

Similar Projects