Skip to main content

CLI tool for managing environment variable hoards bound to named profiles or working directories.

Project description

dotgoblin

CLI tool for managing environment variable hoards bound to named profiles or working directories. Secrets stay off disk via shell interpolation at runtime.

Installation

With uv (recommended)

# Run directly without installing
uvx dotgoblin --help

# Install globally
uv tool install dotgoblin

# Install from source
uv tool install .

# Or add to a project
uv add dotgoblin

With pip

pip install dotgoblin

From source

git clone https://github.com/frizzy/dotgoblin.git
cd dotgoblin
uv sync

Quick start

# Create a hoard
dotgoblin hoard create myapp

# Add variables
dotgoblin var set myapp DATABASE_URL "postgres://localhost:5432/app"
dotgoblin var set myapp API_KEY '$(pass show myapp/api-key)'

# Bind your project directory to the hoard
cd ~/Code/myapp
dotgoblin bind myapp

# Run a command with the injected env
dotgoblin -- flask run

# Or reference a hoard explicitly
dotgoblin myapp -- flask run

# Preview what would be injected
dotgoblin --dry-run -- flask run

Concepts

  • Hoard — a named collection of environment variables stored as TOML
  • Binding — maps a working directory to a hoard, so dotgoblin -- <cmd> auto-selects it
  • Section — hoards can have named sections (e.g. local, prod) that override base variables
  • Secret interpolation — values like $(pass show key) are evaluated at runtime, keeping secrets off disk

Storage

All config lives in ~/.config/dotgoblin/ (override with DOTGOBLIN_DIR):

~/.config/dotgoblin/
├── hoards/
│   ├── myapp.toml
│   └── ...
└── bindings.toml

Hoard file format

# Top-level variables apply to all sections
APP_NAME = "myapp"

[_meta]
default = "local"

[local]
DATABASE_URL = "postgres://localhost:5432/app"
API_KEY = "$(pass show local/api-key)"

[prod]
DATABASE_URL = "postgres://prod.db:5432/app"
API_KEY = "$(pass show prod/api-key)"

Commands

Run a command

dotgoblin -- <command...>                      # use bound hoard
dotgoblin <name> -- <command...>               # use named hoard
dotgoblin <name>:<section> -- <command...>     # named hoard, specific section
dotgoblin :<section> -- <command...>           # bound hoard, specific section
dotgoblin --dry-run -- <command...>            # preview without running

The hoard reference is the single token before --. Variables are merged on top of your current shell environment.

Manage hoards

dotgoblin hoard create <name>    # create a new empty hoard
dotgoblin hoard list             # list all hoards (alias: ls)
dotgoblin hoard show <name>      # show variables (secrets shown as raw expressions)
dotgoblin hoard cat <name>       # print resolved env in envfile format (--export for `export …`)
dotgoblin hoard edit <name>      # open in $EDITOR
dotgoblin hoard rm <name>        # delete (fails if bound)

Manage variables

dotgoblin var set <hoard> <KEY> <value>    # set a variable
dotgoblin var rm <hoard> <KEY>             # remove a variable

Bindings

Multiple directories can be bound to the same hoard.

dotgoblin bind [<hoard-name>]            # bind current directory to a hoard
dotgoblin bind add <hoard-name> <dir>    # bind an arbitrary directory
dotgoblin bind list [<hoard-name>]       # list all bindings (or filter by hoard) (alias: ls)
dotgoblin bind rm [<directory>]          # remove a binding (default: cwd)
dotgoblin unbind                         # shortcut for bind rm
dotgoblin status                         # show active hoard and variables

If bind is called without a hoard name, an anonymous hoard is created automatically.

Secret interpolation

Any value containing $(...) is treated as a shell expression and evaluated at runtime. This keeps secrets out of the store files.

API_KEY = "$(pass show myapp/api-key)"
TOKEN = "Bearer $(cat ~/.tokens/myapp)"
DB_PASS = "$(op read 'op://Vault/DB/password')"

Interpolation only happens during dotgoblin -- <cmd> and --dry-run. All other commands display the raw expression. If a command fails, dotgoblin aborts with the failing key and stderr.

Resolution order

  1. Hoard reference before -- (explicit, highest priority)
  2. Directory binding (from bindings.toml)
  3. Error: no hoard found

Environment

Variable Description
DOTGOBLIN_DIR Override config directory (default: ~/.config/dotgoblin/)
EDITOR Editor used by dotgoblin hoard edit (default: vi)

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dotgoblin-0.2.0.tar.gz (18.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dotgoblin-0.2.0-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

Details for the file dotgoblin-0.2.0.tar.gz.

File metadata

  • Download URL: dotgoblin-0.2.0.tar.gz
  • Upload date:
  • Size: 18.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for dotgoblin-0.2.0.tar.gz
Algorithm Hash digest
SHA256 6509d1d027d1dc95ad7830785994cd7d8f27e3c94206aa1e1dda3eb831adbd5c
MD5 b1822be99ec795c3bff6686cd40bb3b7
BLAKE2b-256 b3fb12e438695ec5ab1eb7f783fb5d4bf9516568b1de756e685f1123db7750b7

See more details on using hashes here.

File details

Details for the file dotgoblin-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: dotgoblin-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 11.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for dotgoblin-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fc8d0d7be0ff062eb169086a7828912813d6fe5b0fc6fa0b00977326e01a70ba
MD5 fd76ee97ee3b613e973d68097f04000a
BLAKE2b-256 c8b7d9a56644791e0f24f36fef8fe320e5446331f1f849b308883507312e2f66

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page