Contexts & Environments
Hyve has two similar-sounding ideas that do different jobs:
| Context | Environment | |
|---|---|---|
| What it is | This machine’s pointer at where state lives | A named scope inside your organization on a hyve-api server |
| Lives | Locally, in ~/.hyve/hyve.db | On the server, shared by everyone in the organization |
| Points at | A local directory, a hyve-api URL, or both | A set of clusters (default, staging, production, …) |
| Command | hyve context | hyve environment |
| Modes | Local and cluster mode | Cluster mode only |
Contexts
A context is a thin record — a name, a local path, and optionally a hyve-api URL. Hyve has no built-in git functionality: it never clones, pulls, pushes, or commits anything. A context only tracks where your commands read from and write to.
hyve context create prod --path ~/repos/prod-confighyve context use prod # subsequent commands read/write herehyve context currenthyve context listLocal mode: a plain directory, git optional
A local-directory context holds clusters/, templates/, workflows/, resources/, hyve.yaml, and hyve.lock — plain files hyve reconcile reads and writes directly.
Cluster mode: a hyve-api server
hyve context login --api-url https://hyve.example.com # registers the context too, if it's newThe active context decides the mode: a context with an API URL sends cluster commands to that server; one without works on local files. Switching contexts never logs you out, and logging in never switches which context is active (except that your very first login on a machine activates the context it registers).
Environments
Once you’re in cluster mode, an environment scopes the clusters you work with. Every organization starts with default; create more as you need them. Clusters are created in one environment, and two environments can each hold a cluster with the same name.
hyve environment create staginghyve environment use staging # remembered on the active contexthyve cluster list # only staging's clustershyve cluster show web --env default # one-off override