(First GO project after learning GO for 3 weeks after endsems.)
In my internship everyone begs for env and reply comes late sometimes from people which is annoying asl so I figured i might as well make an open source CLI tool just for the sake of it.
idc if people use it or not tbh.
i named it envv since its similar to git
it scans ur repo for .env files and stores each file in a mongo document and each repo is a separate cluster (yet to implement) rn its one cluster.
each doc is hashed and every update we check this hash for changes and if there are any we replace the doc with local file. (yet to implement)
what is implemented is :
envv init which makes a repo hash and stores it in mongo and makes a doc of each env with its own hash and stores it in mongo.
also have git import command which takes a folder name and imports it to local
- Go: v1.25.5 or higher
- MongoDB: A running MongoDB instance (Atlas or local)
Install the binary into your GOBIN so you can use it anywhere:
go install ./src/cmd/envvEnsure your PATH includes your Go bin directory (e.g., export PATH=$PATH:$(go env GOPATH)/bin).
To build the binary in the current directory:
go build -o envv ./src/cmd/envvThe tool requires a MONGO_URI to connect to your database. You can provide this in two ways:
-
Environment Variable:
export MONGO_URI="mongodb://your-mongodb-uri"
-
Local .env File: Create a
.envfile in the project root:MONGO_URI=mongodb://your-mongodb-uri
Scan the current repository and upload all discovered .env files to MongoDB:
envv initRestore a specific .env file from MongoDB back to your local filesystem:
envv import <folder_name>- Use
rootor.for the repository root.
- The tool handles creating missing parent directories automatically.
src/cmd/envv: Main application entry point and command implementations (Cobra).src/environ: Core logic for scanning, hashing, and writing.envfiles.src/model: Data structures for database storage.src/store: MongoDB interaction layer.src/config: Configuration loading and management.