Skip to content

bbkane/enventory

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

enventory

./demo.gif

Centrally manage environment variables with SQLite

  • Automatically export/unexport environments when entering/leaving directories
  • Keep a global view of which variables apply to which projects (as well as date created/updated, optional comments).
  • Filter environments to keep your view manageable:
enventory env list --expr 'filter(Envs, hasPrefix(.Name, "test") and .UpdateTime > now() - duration("90d"))'
  • Share variables between environments with variable references
  • Advanced tab completion! Autocomplete commands, flags, env names, var/ref names
  • Currently only supports zsh

Project Status

I'm using enventory personally and I quite enjoy using it! That said, I work on enventory for fun/learning, which means changing API and CLI structure as I feel like it (I feel pretty good about the current structure though).

I do my best to test changes to the codebase (I've actually got a pretty neat snapshot test system), and I've never lost data, but I'm only human, so back up sensitive API keys in a password safe (I really like KeePassXC) instead of storing them soley in envetory

Install

scoop bucket add bbkane https://github.com/bbkane/scoop-bucket
scoop install bbkane/enventory
  • Download Mac/Linux/Windows executable: GitHub releases
  • Go: go install go.bbkane.com/enventory@latest
  • Build with goreleaser after cloning: goreleaser release --snapshot --clean

Initialize in ~/.zshrc

zsh is currently the only shell supported

eval "$(enventory shell zsh init)"

This also provides functions export-env and unexport-env to easily export environments into the current shell session:

export-env my-environment

Initialize zsh Tab Completion

enventory is quite a verbose CLI, so tab completion (which also auto-completes env names, var names, and var ref names) is super useful (to the point where I wouldn't want to use enventory without it). Homebrew does this automatically.

enventory completion zsh > /something/in/$fpath

Alternatives

Turns out there are a lot of options in this space! Here are some of my favorites:

  • direnv - uses .envrc files in directories to export variables
  • dotenv - a family of tools to store env vars in config files in directories. Optional encryption
  • envchain - Save environment variables in the OS keychain
  • envelope - another approach to using SQLite to store environment variables. Side note: I had originally named enventory envelope. I changed the name once I noticed this project.
  • mise - manages tool versions, environments, and tasks through config files in directories

Dev Notes

See Go Project Notes for notes on development tooling and CI/CD setup (including demo gif generation)

Generate ./dbdoc with tbls

Install:

brew install k1LoW/tap/tbls

Run:

# get a fresh db
go run . env list --db-path tmp.db
tbls doc --rm-dist
go generate ./...

Export OTEL traces!

Debug enventory with OTEL tracing:

MOTEL_TRACES_EXPORTER=stdout go run . env show

See the motel repo for other ways to visualize OTEL traces

Manually test custom completions

See wargs instructions

About

Centrally manage project environment variables with SQLite

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •