Skip to main content

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

Project description

dotgoblin

CLI tool for managing environment variable sets 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 set
dotgoblin set 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 set
cd ~/Code/myapp
dotgoblin bind myapp

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

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

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

Concepts

  • Set — a named collection of environment variables stored as TOML
  • Binding — maps a working directory to a set, so dotgoblin -- <cmd> auto-selects it
  • Section — sets 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/
├── sets/
│   ├── myapp.toml
│   └── ...
└── bindings.toml

Set 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...>
dotgoblin --set <name> -- <command...>
dotgoblin --set <name>:<section> -- <command...>
dotgoblin --set :<section> -- <command...>    # use bound set with specific section
dotgoblin --dry-run -- <command...>

Variables are merged on top of your current shell environment.

Manage sets

dotgoblin set create <name>    # create a new empty set
dotgoblin set list             # list all sets
dotgoblin set show <name>      # show variables (secrets shown as raw expressions)
dotgoblin set edit <name>      # open in $EDITOR
dotgoblin set rm <name>        # delete (fails if bound)

Manage variables

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

Bindings

Multiple directories can be bound to the same set.

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

If bind is called without a set name, an anonymous set 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. --set <name> flag (explicit, highest priority)
  2. Directory binding (from bindings.toml)
  3. Error: no set found

Environment

Variable Description
DOTGOBLIN_DIR Override config directory (default: ~/.config/dotgoblin/)
EDITOR Editor used by dotgoblin set 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.0.2.tar.gz (9.2 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.0.2-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dotgoblin-0.0.2.tar.gz
  • Upload date:
  • Size: 9.2 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.0.2.tar.gz
Algorithm Hash digest
SHA256 7a6522d95a8a7243c67aa755d9dfc244d6a4d3c66c0dba56c3cfb7816383d64f
MD5 7a2b6b2aaa0b4e1ccfc68f95ae57d1ca
BLAKE2b-256 12289cbb6e223901caef9b9439edb01fc129d3c5f15f622fb73c6b337a4378bc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dotgoblin-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 10.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.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6722170e56d3d87537004b1c09ca761b11f64e7718e683aff124d1c98d27bc70
MD5 63937c337e3be2295b96b1853e405cf0
BLAKE2b-256 665817be517d5aa2db874c77ffa7321a6cd030a72c4f92a30016378fd88b45c8

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